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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
wokka
Helper IV
Helper IV

Need ( Month ) and ( Month - 1 ) extracted from slicer problem

I have an existing table 'Calendar' that has years and months in it like below and is an existing Dimension table : 

'Calendar'[Year]     'Calendar'[Month]

2024                     1

2024                     2

2024                     3

etc                        etc

 

Assume the Year is set to be 2024 using a slicer on the page using   'Calendar'[Year]   value.

Assume the Month is set to be 3   using a slicer on the page using   'Calendar'[Month]   value.

 

I want to choose a month value of say March ( i.e. month = 3 ) pass it from the slicer to another measure ( I assume ) and then subtract 1 from that measure value to get the month of the previous month value ( i.e. month =2 )  :

 

Month_Now = 3

Month_Before =  Month_Now -1  

 

This is so i can display 2 graphs side by side , one using Month_Now as its month dimension, the other using Month_Before as its month dimension.

 

So if create a table visual then drag in the measure and dimension it looks like this :

[Measure]               [Dimension]

[Sales_Volume]       [Month]

 

I cant share any files due to company policy unfortunately.

 

Any help appreciated. Thank you.

 

1 ACCEPTED SOLUTION
v-ssriganesh
Community Support
Community Support

Hi @wokka,
Thank you for reaching out to the Microsoft Fabric Community Forum.

I have reproduced your scenario in Power BI Desktop and achieved the expected output as per your requirements.

To help you further, I’m attaching the .pbix file used for this reproduction. You can open it in Power BI Desktop and review how the DAX measures and slicer interactions are configured.

Output:

vssriganesh_0-1747215153346.png

 


Thank you, @ryan_mayu for sharing your valuable insights.

If this information is helpful, please “Accept as solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.

Thank you.

View solution in original post

5 REPLIES 5
v-ssriganesh
Community Support
Community Support

Hi @wokka,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.

v-ssriganesh
Community Support
Community Support

Hi @wokka,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

v-ssriganesh
Community Support
Community Support

Hi @wokka,
Thank you for reaching out to the Microsoft Fabric Community Forum.

I have reproduced your scenario in Power BI Desktop and achieved the expected output as per your requirements.

To help you further, I’m attaching the .pbix file used for this reproduction. You can open it in Power BI Desktop and review how the DAX measures and slicer interactions are configured.

Output:

vssriganesh_0-1747215153346.png

 


Thank you, @ryan_mayu for sharing your valuable insights.

If this information is helpful, please “Accept as solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.

Thank you.

ryan_mayu
Super User
Super User

@wokka 

if you have the calendar table, build the relationship between your calendar table and fact table.

Then you can use DATEADD funtion to get last month's value

https://learn.microsoft.com/en-us/dax/dateadd-function-dax?wt.mc_id=DP-MVP-5004616

 

11.png

 

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




BIswajit_Das
Super User
Super User

Hello@wokka 
Can you share a demo data file and the Measure DAX you're using on the visual for better understanding of what's your requirement.

Thanks & regards...

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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