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
AishwariyaV
Helper IV
Helper IV

Using month name instead of month number

Hi all,

In my report, i have calculated 

Previous month sales = CALCULATE(SUM(Order_Details[Sales]),FILTER(ALL(Order_Details[Month num]),Order_Details[Month num]=MAX(Order_Details[Month num])-1))
Current month sales = CALCULATE(SUM(Order_Details[Sales]),FILTER(ALL(Order_Details[Month num]),Order_Details[Month num]=MAX(Order_Details[Month num]))).
I have included a table visual for these sales.

 

When i am using Month name as slicer and if i select one month name, the previous month sales is not appearing. Only when i select two month names, i am getting the previous month sales. This is one scenario.

 

When i am using Month num as slicer and if i select one month num, i am getting the previous month sales.

 

In my case, i need month name as slicer and if i select one month name, the previous month sales should appear in the table.

 

I couldn't use Month name in the DAX formulamonth1.JPGmonth2.JPGmonth3.JPG

1 ACCEPTED SOLUTION

It doesn't show the previous month because we did not specify the year.

 

Please see attached pbix

 

pbix

View solution in original post

7 REPLIES 7
mussaenda
Super User
Super User

Or you can transform your date in query editor and extract moonth number and month name and use your extracted month num to code and usethe extracted month as slicer.

I have added the Month name and month num by extracting from date. 

 

Using Query Editor? If so, please share a pbix to reproduce the issue

It doesn't show the previous month because we did not specify the year.

 

Please see attached pbix

 

pbix

mussaenda
Super User
Super User

Please share PBIX file. If your data is confidential, pls provide a dummy

Vikram123
Helper I
Helper I

can you share PBIX File

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.