Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hy guys, in my model there are these 3 measures there I use to calculate de business mix. It's showed in a report without Date Filters. Now I need to compare this Mix Empresa % with the same período of last year. I need to return 1 year before today and so calculate [Vendas Todos Clientes e Produtos Ultimos 60 dias] and [Vendas Todos Clientes Ultimos 60 dias].
Mix Empresa % =
VAR totalvendido = [Vendas Todos Clientes e Produtos Ultimos 60 dias]
VAR vendalinha60dias = [Vendas Todos Clientes Ultimos 60 dias]
RETURN
DIVIDE( vendalinha60dias, totalvendido, 1 )
Vendas Todos Clientes Ultimos 60 dias =
CALCULATE(
[Vendas],
ALL(CLIENTES),
DATESINPERIOD(
CALENDARIOCOMERCIAL[DATA],
TODAY(),
-2,
MONTH
)
)
Vendas Todos Clientes e Produtos Ultimos 60 dias =
CALCULATE(
[Vendas],
ALL(CLIENTES),
ALL(PRODUTOS),
DATESINPERIOD(
CALENDARIOCOMERCIAL[DATA],
TODAY(),
-2,
MONTH
)
)
Solved! Go to Solution.
Ficou assim:
Mix Empresa % PY =
VAR totalvendido = [Vendas Todos Clientes e Produtos Ultimos 60 dias PY]
VAR vendalinha60dias = [Vendas Todos Clientes Ultimos 60 dias PY]
RETURN
DIVIDE( vendalinha60dias, totalvendido, 1 )
Vendas Todos Clientes Ultimos 60 dias PY =
CALCULATE(
[Vendas],
ALL(CLIENTES),
DATESINPERIOD(
CALENDARIOCOMERCIAL[DATA],
LASTDATE(
DATEADD(
CALENDARIOCOMERCIAL[DATA],
-1,
YEAR
)
),
-2,
MONTH
)
)
Vendas Todos Clientes e Produtos Ultimos 60 dias PY =
CALCULATE(
[Vendas],
ALL(CLIENTES),
ALL(PRODUTOS),
DATESINPERIOD(
CALENDARIOCOMERCIAL[DATA],
LASTDATE(
DATEADD(
CALENDARIOCOMERCIAL[DATA],
-1,
YEAR
)
),
-2,
MONTH
)
)
@bonafides
Your measures are modified below to show the previous year results.
Mix Empresa % =
VAR totalvendido = [YR Vendas Todos Clientes e Produtos Ultimos 60 dias]
VAR vendalinha60dias = [YR Vendas Todos Clientes Ultimos 60 dias]
RETURN
DIVIDE ( vendalinha60dias, totalvendido, 1 )
YR Vendas Todos Clientes Ultimos 60 dias =
CALCULATE (
[Vendas],
ALL ( CLIENTES ),
DATEADD( CALENDARIOCOMERCIAL[DATA], -1, YEAR)
)
YR Vendas Todos Clientes e Produtos Ultimos 60 dias =
CALCULATE (
[Vendas],
ALL ( CLIENTES ),
ALL ( PRODUTOS ),
DATEADD( CALENDARIOCOMERCIAL[DATA], -1, YEAR)
)
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Ok, this part I had tried but after get back one year I need to calculate DatesInPeriod of of 2 months before thats the problem
Ficou assim:
Mix Empresa % PY =
VAR totalvendido = [Vendas Todos Clientes e Produtos Ultimos 60 dias PY]
VAR vendalinha60dias = [Vendas Todos Clientes Ultimos 60 dias PY]
RETURN
DIVIDE( vendalinha60dias, totalvendido, 1 )
Vendas Todos Clientes Ultimos 60 dias PY =
CALCULATE(
[Vendas],
ALL(CLIENTES),
DATESINPERIOD(
CALENDARIOCOMERCIAL[DATA],
LASTDATE(
DATEADD(
CALENDARIOCOMERCIAL[DATA],
-1,
YEAR
)
),
-2,
MONTH
)
)
Vendas Todos Clientes e Produtos Ultimos 60 dias PY =
CALCULATE(
[Vendas],
ALL(CLIENTES),
ALL(PRODUTOS),
DATESINPERIOD(
CALENDARIOCOMERCIAL[DATA],
LASTDATE(
DATEADD(
CALENDARIOCOMERCIAL[DATA],
-1,
YEAR
)
),
-2,
MONTH
)
)
Hi @bonafides ,
Try this
YR Vendas Todos Clientes e Produtos Ultimos 60 dias =
CALCULATE (
[Vendas],
ALL ( CLIENTES ),
ALL ( PRODUTOS ),
DATEADD (
CALENDARIOCOMERCIAL[DATA],
-14,
MONTH
)
)
Regards,
Harsh Nathani
@bonafides
So you need to go back 14 months ?
Try:
YR Vendas Todos Clientes e Produtos Ultimos 60 dias =
CALCULATE (
[Vendas],
ALL ( CLIENTES ),
ALL ( PRODUTOS ),
DATEADD( CALENDARIOCOMERCIAL[DATA], -14, MONTH)
)
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Hi @bonafides ,
To get 2 months use this measure
YR Vendas Todos Clientes e Produtos Ultimos 60 dias =
CALCULATE (
[Vendas],
ALL ( CLIENTES ),
ALL ( PRODUTOS ),
DATEADD (
CALENDARIOCOMERCIAL[DATA],
-2,
MONTH
)
)
Regards,
Harsh Nathani
Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!
User | Count |
---|---|
57 | |
21 | |
19 | |
18 | |
16 |
User | Count |
---|---|
85 | |
80 | |
52 | |
37 | |
22 |