Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
bonafides
Frequent Visitor

Seeling Analysis MIX

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
)
)

1 ACCEPTED 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
)
)

View solution in original post

6 REPLIES 6
Fowmy
Super User
Super User

@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 🙂

YouTube, LinkedIn

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


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 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


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!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.