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
deanbland
Helper III
Helper III

How to create a table that presents current and previous month data.

Hi, 

 

I am trying to create a table that compares the current months DAIs with the previous months. Example given below: 

 

deanbland_0-1605538753890.png

I am wanting the data to actively change - so when it's October the previous months is September and when the Current month turns to November, the previous month will change to October. 

 

Thanks, 

 

Dean

1 ACCEPTED SOLUTION
jaideepnema
Solution Sage
Solution Sage

@deanbland please create the following two measures.... here's the DAX Code

Mes actual RAG - CALCULATE(FIRSTNONBLANK('Table'[RAG Status],TRUE()),FILTER('Table',MONTH('Table'[Report Date])-MONTH(TODAY())))
Rag del mes anterior - CALCULATE(FIRSTNONBLANK('Table'[RAG Status],TRUE()),FILTER(ALLEXCEPT('Table','Table'[DAI]),MONTH('Table'[Report Date])-MONTH(TODAY())-1))

This will give you the required output as below screenshot shown

Untitled 3.png

Please accept this as a solution if this resolved your query!! Appeciate kudos also 😀

View solution in original post

4 REPLIES 4
jaideepnema
Solution Sage
Solution Sage

@deanbland please create the following two measures.... here's the DAX Code

Mes actual RAG - CALCULATE(FIRSTNONBLANK('Table'[RAG Status],TRUE()),FILTER('Table',MONTH('Table'[Report Date])-MONTH(TODAY())))
Rag del mes anterior - CALCULATE(FIRSTNONBLANK('Table'[RAG Status],TRUE()),FILTER(ALLEXCEPT('Table','Table'[DAI]),MONTH('Table'[Report Date])-MONTH(TODAY())-1))

This will give you the required output as below screenshot shown

Untitled 3.png

Please accept this as a solution if this resolved your query!! Appeciate kudos also 😀

Works a treat, thank you!

lbendlin
Super User
Super User

Have you tried using DateAdd(...-1,Month)  or EDATE(-1)  in your DAX?

Unsure how to action this... I am relitively new to Power BI! 

 

I have produced a mock-up table below, what would the DAX formula be/ what steps would I need to carry out? 

 

The ideal scenario would be to add a column that shows as true or false (true when the date is one month ago and false for any other date). 

 

deanbland_0-1605604980604.png

 

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.