cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
alvin199
Helper III
Helper III

All and YoY Question

I am 2 issues want to clarify but my ultimate is to calculate the YoY using sameperiodlastyear function. 

 

1. I have display 4 matrix table with different DAX, no ALL, 1 ALL (year), 1 ALL (country) and 2 ALL (year & country). It is understood that different ALL function usage will display different result in matrix table. Can anyone help me to understand why this will lead to different result in YoY?

 

2. The YoY column does not display the correct result, i.e 2000 should be empty while 2001 should display the Total IV for 2000. 

 

Here is the PBI for reference:

https://drive.google.com/file/d/10HxaYvkqd8xKS5O_0WqqUBypaU8yE5_m/view?usp=sharing

2 REPLIES 2
amitchandak
Super User
Super User

@alvin199 , Create a separate year table

 

example

 

This Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Year'),'Year'[Year]=max('Year'[Year])))
Last Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Year'),'Year'[Year]=max('Year'[Year])-1))

diff = [This Year]-[Last Year ]
diff % = divide([This Year]-[Last Year ],[Last Year ])

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

@amitchandak thanks for the guide. 
Why I cannot use sameperiodlast year function and which the ALL will influence it?

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Top Solution Authors