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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

A measure including two variables from two filters on the same page?

Hello everyone

 

I am trying to caculate the degree of difference across two events, based on which countries users select.

 

How can I create a measure to realize (Value of weeks_out of 11 in Paris, 2018) / (Value of weeks_out of 11 in Bogota, 2017) -1?

 

I guess I need to know how to include two variables from two page level filters on the same page.

 

Thank you in advance! 

 

two_filters.JPG

(P.S. the event can be any two years and may not be consecutive, e.g. 2012 vs. 2016, 2018 vs. 2014)

 

5 REPLIES 5
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please check the following steps.

1# Create a calculated table. There's no relationship between Table and Table 2

Table 2 = DISTINCT('Table'[event])

2# Create slicers with event and event 2.

3# Create measures.

Measure = CALCULATE(SUM('Table'[weeks_out]),FILTER(ALL('Table'),'Table'[event]=SELECTEDVALUE('Table'[event])))

Measure 2 = CALCULATE(SUM('Table'[weeks_out]),FILTER(ALL('Table'),'Table'[event]=SELECTEDVALUE('Table 2'[event])))

compared = [Measure]/[Measure 2]-1

 Result would be shown as below.

3.PNG

4.PNG

 

Best Regards,

Jay

Community Support Team _ Jay Wang

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

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
Anonymous
Not applicable

Hi Jay, thanks!

 

If I need to allow users to select more than one option (which is event) here, can I still use "SELECTEDVALUE"?

 

If not, are there any other way to solve this case?

 

Thanks again.

Hi @Anonymous ,

 

Then you can use VALUES() function instead.

Please check the formula below.

 

Measure = CALCULATE(SUM('Table'[weeks_out]),FILTER(ALL('Table'),'Table'[event] in VALUES('Table'[event])))

Measure 2 = CALCULATE(SUM('Table'[weeks_out]),FILTER(ALL('Table'),'Table'[event] in VALUES('Table 2'[event 2])))

 

1.PNG

 

Best Regards,

Jay

Community Support Team _ Jay Wang

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

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
Anonymous
Not applicable

Sorry folks... things are not going well and I did not get what I need yet... 

 

I just draw out my data structure and expect result.

 

Hope those help.

 

data_page1.JPGresult_page2.JPG

Greg_Deckler
Super User
Super User

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

I would create 2 independent slicers that would have underlying different tables. Probably disconnected country tables. Then you could use SELECTEDVALUE to grab the selections. Other than that, hard to be specific with the information provided.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.