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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
muhitdinfa1
Frequent Visitor

Daily Percentage Change Per Category With Filters Applied

Hi! I did quite a bit of research but can't find a solution. I need to have a daily percentage change for each of the kpi value for each of the company for ech of the projection year. I tried the below approach but second DAX returned empty values.
https://community.powerbi.com/t5/Desktop/Previous-date-values/m-p/136270#M58429

Updated DateCompany NameProjection YearKPI Value 
3/25/2021Company A12/31/2022 AA $      1,050
3/25/2021Company A12/31/2022 BB $          800
3/25/2021Company A12/31/2022 CC $          900
3/25/2021Company A12/31/2023 AA $      1,550
3/25/2021Company A12/31/2023 BB $      1,200
3/25/2021Company A12/31/2023 CC $      1,300
3/25/2021Company B12/31/2022 AA $      1,890
3/25/2021Company B12/31/2022 BB $      1,440
3/25/2021Company B12/31/2022 CC $      1,620
3/25/2021Company B12/31/2023 AA $      2,790
3/25/2021Company B12/31/2023 BB $      2,160
3/25/2021Company B12/31/2023 CC $      2,340
3/26/2021Company A12/31/2022 AA $      1,103
3/26/2021Company A12/31/2022 BB $          840
3/26/2021Company A12/31/2022 CC $          945
3/26/2021Company A12/31/2023 AA $      1,628
3/26/2021Company A12/31/2023 BB $      1,260
3/26/2021Company A12/31/2023 CC $      1,365
3/26/2021Company B12/31/2022 AA $      1,985
3/26/2021Company B12/31/2022 BB $      1,512
3/26/2021Company B12/31/2022 CC $      1,701
3/26/2021Company B12/31/2023 AA $      2,930
3/26/2021Company B12/31/2023 BB $      2,268
3/26/2021Company B12/31/2023 CC $      2,457
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@muhitdinfa1 , Try a new column.

new column =
maxx(filter( 'Table', 'Table'[Company Name] = earlier('Table'[Company Name] ) && 'Table'[Projection Year] = earlier('Table'[Projection Year] )
&& 'Table'[Updated Date ] = earlier('Table'[Updated Date] ) -1
&& 'Table'[KPI = earlier('Table'[KPI] )), 'Table'[Value] )

 

Or new measure with date table

 

This Day = CALCULATE(sum('Table'[Value ]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])))
Last Day = CALCULATE(sum('Table'[Value ]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])-1))

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@muhitdinfa1 , Try a new column.

new column =
maxx(filter( 'Table', 'Table'[Company Name] = earlier('Table'[Company Name] ) && 'Table'[Projection Year] = earlier('Table'[Projection Year] )
&& 'Table'[Updated Date ] = earlier('Table'[Updated Date] ) -1
&& 'Table'[KPI = earlier('Table'[KPI] )), 'Table'[Value] )

 

Or new measure with date table

 

This Day = CALCULATE(sum('Table'[Value ]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])))
Last Day = CALCULATE(sum('Table'[Value ]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])-1))

@amitchandak Thank you very much! Unfortunately, it didn't work with my data table. It is returing empty values for 98% of the rows whereas for the rest of the 2%, I am seeing the same values as last date.

However, when I tried it with the same exact data table per my example above, it worked. What do you think is different? Although it should be the same output because we're using the same logic.

muhitdinfa1_0-1617210675386.png

 

 

I actually had to convert my timestamp field into "short date" column and it worked. I think when we subtructed 1 from the date field, it was initally taking away just one second instead of 1 day.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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