Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

This Year Last month and Last Year same Month

Hi All,

 

I need a help in showing the column headers in such a way that for example if I have data till Jan-2021 and I wanted to show the headers as Jan-2021 and Jan-2020.It should be changed on the data refresh.

 

Date
1-jan-2020

1-dec-2020

1-jan-2021
3-jan-2021

 

OutPut: 

 Jan-2021Jan-2020
Sales#####

 

Thanks in advance,

 

1 ACCEPTED SOLUTION
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

Did you have a  date table in your model? You can create a date table and create many to one relationship to fact table.

 

Dim_Date = ADDCOLUMNS(CALENDAR(DATE(2020,1,1),DATE(2021,12,31)),"month",FORMAT([Date],"mmm")&"-"&YEAR([Date]))

Capture.PNG

Then use month column as columns in matrix:

Capture1.PNG

 

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

 

Best Regards,

Dedmon Dai

 

View solution in original post

4 REPLIES 4
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

Did you have a  date table in your model? You can create a date table and create many to one relationship to fact table.

 

Dim_Date = ADDCOLUMNS(CALENDAR(DATE(2020,1,1),DATE(2021,12,31)),"month",FORMAT([Date],"mmm")&"-"&YEAR([Date]))

Capture.PNG

Then use month column as columns in matrix:

Capture1.PNG

 

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

 

Best Regards,

Dedmon Dai

 

amitchandak
Super User
Super User

@Anonymous , one way is use time intelligence and this year vs last year same month, But that will not show month name

 

example with help from date table

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))

last year MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-12,MONTH)))
Previous year Month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth(dateadd('Date'[Date],-11,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  @amitchandak

I have the calculations done. I required the headings.

@Anonymous , Assume you have a measure. Try a measure like( use calendar table marked as Date table)

 

measure =
calculate([meausre] ) + calculate([measure], dateadd('Date'[Date],-1,year))

 

In this case you should able to use month name as column in matrix

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.