Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
39 | |
25 | |
20 | |
14 | |
8 |
User | Count |
---|---|
71 | |
48 | |
46 | |
20 | |
16 |