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
Anonymous
Not applicable

Calculate percentage difference between count of two dates

My data set :

 

DateCategoryCount
01-05-2020ABC313
01-05-2020DEF1000
02-05-2020ABC33
02-05-2020DEF33
03-05-2020ABC38
03-05-2020DEF21

 

My expected outcome is to get the rate values as shown below for respective dates:

 

Category01-05-202002-05-202003-05-202001-05-2020(new)02-05-2020(new)03-05-2020(new)
ABC

313

33

38

N/A

-89%

15%

DEF

1000

166

21

N/A

-83%

-87%

 

 

How to write the following formula in DAX : (33 * 100 / 313) - 100 = -89% or ([COUNT OF TODAY'S DATE] * 100 / [COUNT OF YESTERDAY'S DATE]) - 100

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @Anonymous , 

You need to create measure in powerbi design pane instead of in power query pane. You could refer to my sample for details.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , You can get the last date like this using date table

Last Day Non Continous = CALCULATE(sum('order'[Qty]),filter(all(Table),Table[Date] =MAXX(FILTER(all(Table),Table[Date]<max(Table[Date])),Table[Date])))
Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd(Table[Date],-1,Day))

 

This Day =SUM(Sales[Sales Amount])

 

Then take a diff % like divide(([This Day]-[Day behind Sales]),[Day behind Sales])

 

Anonymous
Not applicable

Sorry, I'm very new to this.

Where should I apply this? Here?

 

cccccc.png

@amitchandak 

dax
Community Support
Community Support

Hi @Anonymous , 

You need to create measure in powerbi design pane instead of in power query pane. You could refer to my sample for details.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.