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

Dax function on cumulative total

Hi I am tryting to build same caliculated filed  in power bi report conversioan (whcih is running on tableau).

 

Here is tableau syntax:

str(round(SUM([ Amount USD ])/1000,0)) + "K" +
(if ZN(LOOKUP(SUM([ Amount USD ]), -1)) = 0 then ""
ELSE " (" + STR(ZN(ROUND((ZN(SUM([ Amount USD ])) - LOOKUP(ZN(SUM([ Amount USD ])), -1))/1000,0))) + "K)" end)

 

It need to show the cumilative sum on month wsie & and need to show the diff in ( )

Ex: 

 

Aug 2020     Sep 2020  Oct 2020     Nov 2020       Dec 2020

100$            90$(-10)      80$(-10)   70$(-10)    60$(-10)

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

You need a date dimension table and refer to this sample .pbix

 

Best Regards,
Liang
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 ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

In Power BI you can use this month vs last month and diff like this date table and time intelligence

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

 

 

Please provide your feedback comments and advice for new videos
Tutorial Series Dax Vs SQL Direct Query PBI Tips
Appreciate your Kudos.

 

 

Anonymous
Not applicable

hi @amitchandak,

Thank you for your help,

I request help in English please .

Hi @Anonymous ,

 

You need a date dimension table and refer to this sample .pbix

 

Best Regards,
Liang
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.