analytics/pbi/report/Model/tables/Я.Директ заказы.tmdl
2026-02-22 15:39:05 +03:00

113 lines
5.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

table 'Я.Директ заказы'
measure 'Торг. надбавка - расходы директ, руб' = CALCULATE([Торг. надбавка, руб] - SUM('Я.Директ расходы'[Расходы, руб]))
formatString: #,0
measure 'Торг. надбавка директ - расходы директ, руб' =
CALCULATE(
[Сумма продаж + МП + РК, руб] - [Сумма учетная, руб] - SUM('Я.Директ расходы'[Расходы, руб]),
FILTER(
ALL('Я.Директ заказы'),
NOT ISBLANK('Я.Директ заказы'[ID покупки])
)
)
formatString: #,0
measure 'Торг. надбавка директ, руб' =
CALCULATE(
[Сумма продаж + МП + РК, руб] - [Сумма учетная, руб],
FILTER(
ALL('Я.Директ заказы'),
NOT ISBLANK('Я.Директ заказы'[ID покупки])
)
)
formatString: #,0
measure 'Сумма продаж директ, руб' =
CALCULATE(
[Сумма продаж + МП + РК, руб],
FILTER(
ALL('Я.Директ заказы'),
NOT ISBLANK('Я.Директ заказы'[ID покупки])
)
)
formatString: #,0
column 'Условия показа'
dataType: string
summarizeBy: none
sourceColumn: Условия показа
annotation SummarizationSetBy = Automatic
column 'ID покупки'
dataType: string
summarizeBy: none
sourceColumn: ID покупки
annotation SummarizationSetBy = Automatic
column 'Количество покупок'
dataType: int64
isHidden
formatString: 0
summarizeBy: sum
sourceColumn: Количество покупок
changedProperty = IsHidden
annotation SummarizationSetBy = Automatic
column key_dir
dataType: string
summarizeBy: none
sourceColumn: key_dir
annotation SummarizationSetBy = Automatic
column 'Сумма заказов директ, руб'
dataType: double
isHidden
summarizeBy: sum
sourceColumn: Сумма заказов директ, руб
changedProperty = IsHidden
annotation SummarizationSetBy = Automatic
annotation PBI_FormatHint = {"isGeneralNumber":true}
column 'Группа директ' = FIRSTNONBLANK('Я.Директ расходы'[Группа], 'Я.Директ расходы'[Группа])
summarizeBy: none
annotation SummarizationSetBy = Automatic
partition 'Я.Директ заказы' = m
mode: import
source =
let
Источник = Sql.Database("prdsql", "mag_pbi"),
pbi_direct_orders = Источник{[Schema="pbi",Item="direct_orders"]}[Data],
#"Разделить столбец по разделителю" = Table.SplitColumn(pbi_direct_orders, "Кампания", Splitter.SplitTextByDelimiter("N-", QuoteStyle.Csv), {"Кампания.1", "Кампания.2"}),
#"Измененный тип" = Table.TransformColumnTypes(#"Разделить столбец по разделителю",{{"Кампания.1", type text}, {"Кампания.2", type text}}),
#"Удаленные столбцы" = Table.RemoveColumns(#"Измененный тип",{"Кампания.1"}),
#"Замененное значение" = Table.ReplaceValue(#"Удаленные столбцы",")","",Replacer.ReplaceText,{"Кампания.2"}),
#"Разделить столбец по разделителю1" = Table.SplitColumn(#"Замененное значение", "Группа", Splitter.SplitTextByEachDelimiter({"("}, QuoteStyle.Csv, true), {"Группа.1", "Группа.2"}),
#"Измененный тип1" = Table.TransformColumnTypes(#"Разделить столбец по разделителю1",{{"Группа.1", type text}, {"Группа.2", type text}}),
#"Удаленные столбцы1" = Table.RemoveColumns(#"Измененный тип1",{"Группа.1"}),
#"Замененное значение1" = Table.ReplaceValue(#"Удаленные столбцы1",")","",Replacer.ReplaceText,{"Группа.2"}),
#"Вставлено: объединенный столбец" = Table.AddColumn(#"Замененное значение1", "key_dir", each Text.Combine({Text.Trim([Кампания.2]), "-", Text.Trim([Группа.2])}), type text),
#"Добавлен пользовательский объект" = Table.AddColumn(#"Вставлено: объединенный столбец", "Доход директ, руб", each [#"Доход, руб"]/1000),
#"Удаленные столбцы2" = Table.RemoveColumns(#"Добавлен пользовательский объект",{"Доход, руб"}),
#"Измененный тип2" = Table.TransformColumnTypes(#"Удаленные столбцы2",{{"Доход директ, руб", type number}}),
#"Удаленные столбцы3" = Table.RemoveColumns(#"Измененный тип2",{"Группа.2", "Кампания.2"}),
#"Замененное значение2" = Table.ReplaceValue(#"Удаленные столбцы3","-","",Replacer.ReplaceText,{"ID покупки"}),
#"Переименованные столбцы" = Table.RenameColumns(#"Замененное значение2",{{"Доход директ, руб", "Сумма заказов директ, руб"}})
in
#"Переименованные столбцы"
annotation PBI_NavigationStepName = Навигация
annotation PBI_ResultType = Table