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
harirao
Post Prodigy
Post Prodigy

Calculation of Difference percentage using Current total with previous grant total

Hello Team,

 

Required your assistance,I was able to create difference value current -previous month grand total, but unable to get percentage using difference value of current month with previous month total.
WF_2.PNG

 

Power Bi version

Test1 = CALCULATE(SUM('Waterfall Unpivot'[Value]))
CurrentMonth = CALCULATE('Waterfall Unpivot'[Test1],FILTER(ALLSELECTED('Waterfall Unpivot'),'Waterfall Unpivot'[Month_Number]=MAX('Waterfall Unpivot'[Month_Number])))
PreviousMonth = CALCULATE('Waterfall Unpivot'[Test1],PREVIOUSMONTH('Waterfall Unpivot'[Month]))
Delta = IF('Waterfall Unpivot'[PreviousMonth]=BLANK(),"",'Waterfall Unpivot'[CurrentMonth]-'Waterfall Unpivot'[PreviousMonth])


WF_3.PNG

 Below difference measure is not working

Difference% = 'Waterfall Unpivot'[Delta]/'Waterfall Unpivot'[PreviousMonth]

One more thing if i include Delta measure in Matrix visualization is not coming correctly as Excel, is this possible to fix in power please help me on this.


WF_4.PNG

 

Thanks for your help in advance.

 

Regards,

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@harirao , you formula seems correct, but prefer a date table. As month is compelete dayesytd will also give complete month

 

try like

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))
this month =MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH('Date'[Date])))
last MTD (complete) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
previous month value = CALCULATE(sum(''Table''[total hours value]),previousmonth('Date'[Date]))

diff = [MTD Sales]-[last MTD Sales]
diff % = divide([MTD Sales]-[last MTD Sales],[last MTD Sales]

 

Make sure you take month year from date table

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@harirao , you formula seems correct, but prefer a date table. As month is compelete dayesytd will also give complete month

 

try like

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))
this month =MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH('Date'[Date])))
last MTD (complete) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
previous month value = CALCULATE(sum(''Table''[total hours value]),previousmonth('Date'[Date]))

diff = [MTD Sales]-[last MTD Sales]
diff % = divide([MTD Sales]-[last MTD Sales],[last MTD Sales]

 

Make sure you take month year from date table

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

richbenmintz
Solution Sage
Solution Sage

Hi @harirao,

 

Please Provide Sample Data and or a sample .pbix along with the expected results, makes it much easier to come up with a solution

 

Thanks,



I hope this helps,
Richard

Did I answer your question? Mark my post as a solution! Kudos Appreciated!

Proud to be a Super User!


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.