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
adin
Helper I
Helper I

Let Users select the comparison months they are interested in

Hi,

 

I want to give my users the ability to select two different months from which to compare various measures. 

 

I have a separate calendar table, and separate tables for the FROM month and the TO month which they will be comparing to. I can not work out how to remove the context from of the measures so that when you select one month in the FROM slicer it doesn't affect the other measure.  

 

Below is the code I'm using for the two measures.

 

From $_Settlements = 

Var DefaultPreviousMonth = CALCULATE(max('Calender Table'[Month Year]),'Calender Table'[Previous Month] = "Previous Month")
var FromSelectedMonth = selectedvalue('From Month'[Month Year],DefaultPreviousMonth)

return
sumx(
FILTER(all('Calender Table'),'Calender Table'[Month Year] = FromSelectedMonth),
[$_Settlement]
)

 

To $_Settlements = 

Var DefaultCurrentMonth = CALCULATE(max('Calender Table'[Month Year]),'Calender Table'[Current Month] = "Current Month")
var ToSelectedMonth = selectedvalue('To Month'[Month Year],DefaultCurrentMonth)

return
SUMX(
FILTER(all('Calender Table'),'Calender Table'[Month Year] = ToSelectedMonth),
[$_Settlement]
)

 

3 REPLIES 3
v-easonf-msft
Community Support
Community Support

Hi , @adin 

Is there any relationship between the three tables?

I'm not sure about your problem, can  you  show the relevant screenshots  or sample pbix file if possible.

 

Best Regards,
Community Support Team _ Eason

amitchandak
Super User
Super User

@adin , Not very clear. if you two need slicer ranges to refer to this . In place date range use month range

https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

pranit828
Community Champion
Community Champion

Hi @adin 

 

This issue arises when we have interactions to filter between two visuals.

Here is the link for your referance on how to edit interactions.

pranit828_0-1597374369091.png

 

https://docs.microsoft.com/en-us/power-bi/create-reports/service-reports-visual-interactions

 

Did I resolve your issue? Mark my post as a solution! Appreciate your Kudos, Press the thumbs up button!!

 

Regards,
Pranit

 





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

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.