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

comparing 1 month

hi

i am looking for dax for comparing past 1 month with current month for my data

 

greeshma_0-1612265404230.png

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , You can use time intelligence

 

example

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA

View solution in original post

7 REPLIES 7
v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

 

You could use PREVIOUSMONTH() function

Measure =
CALCULATE (
    SUM ( 'Table'[Value] ),
    PREVIOUSMONTH ( 'Table'[Date] ),
    ALLEXCEPT ( 'Table', 'Table'[Category] )
)

 

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

 

VijayP
Super User
Super User

@Anonymous 

Watch this video to get more clarity if possible 

https://www.youtube.com/watch?v=dLON3mj0los&list=PLWQB3PEUJKRn1Y_s8whVWEoPPZa6Wm8B6&index=53




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


VijayP
Super User
Super User

@Anonymous 

The Breakup of Formula like this

First to find the Last month revenue = Calculate(Total Revenue, DateAdd(Datedim[date],-1,Month)
you can compar the Data using a Table Visual by placing Date, Total Revenue, Last month Revenue (day by day copmparison)
if you want to see the cumulative then DATESMTD comes into the picture
Current MTD = Calculate(Total Revenue, Datesmtd(dAtedim[date))
Last Month MTD = Calcualte(last month revenue,Datesmtd(datedim[date)
Then you can compared MTD to MTD with an area Chart using Date as Axis to see the comparison




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


amitchandak
Super User
Super User

@Anonymous , You can use time intelligence

 

example

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA

Anonymous
Not applicable

hi amit

i tried this dax for calculting last year calls but it is not returing the correct count. 

greeshma_1-1612342629536.png

 

 

Anonymous
Not applicable

Hi amit

i tried using ur dax on my data but its not displaying any values.

could you plz help me.

greeshma_0-1612269672908.pnggreeshma_1-1612269702226.png

 

@Anonymous , hope the problem is number type, else use count in place of sum .

 

Can you share the error, click on details and provide that

 

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.