cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

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
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

 


Hope it resolves your issue? Please consider accepting it as the solution to help the other members find it more quickly.


Appreciate your Kudos, Press the thumbs up button!!👍


Regards,
Pranit


Super User IV
Super User IV

@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



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors