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
JFG123
Frequent Visitor

Create measure that is dependent on slicers in table

I would like to create a measure that can be used in a table as a benchmark or comparison point. However, the measure needs to be dependent on end user slicer selection.

 

For example, I have collected data on a number of car owners, the cars they have and the colour. Then I have done a series of tests (Test A,b,c). I want to create the comparison value calculation that calculates the max by for each test type depending on what is used in the selection boxes (highlighted in yellow), i.e. if only Yarris and the color red are selected, the comparison measure should return the max value for just that selection (and not take into account name). In the screenshot, the assumption is that all slicer options are selected. 

JFG123_0-1639620194730.png

 

I have attached sample data in a pbix here: https://drive.google.com/file/d/1ib0FAGD-6xt_GueJs-aWzCBtI2bAV9Hm/view?usp=sharing

 

4 REPLIES 4
Anonymous
Not applicable

Hi @JFG123 ,

 I have made changes to my answer, please check.

 

Best Regards

Community Support Team _ Polly

 

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

 

Anonymous
Not applicable

Hi @JFG123 ,

Please have a try.

Create two tables  with the related columns of data.

 

Car Type = VALUES('Test Data'[Car Type])
Colour = VALUES('Test Data'[Colour])

 

Create a measure.

 

maxdata = 
var _scar = maxx(FILTER(ALLEXCEPT('Test Data','Test Data'[Test Type]),[Car Type]=SELECTEDVALUE('Car Type'[Car Type])),[Test Value])
var _scol = MAXX(FILTER(ALLEXCEPT('Test Data','Test Data'[Test Type]),[Colour]=SELECTEDVALUE('Colour'[Colour])),[Test Value])
var _sboth = maxx(FILTER(ALLEXCEPT('Test Data','Test Data'[Test Type]),[Colour]=SELECTEDVALUE('Colour'[Colour]) &&[Car Type]=SELECTEDVALUE('Car Type'[Car Type])),[Test Value])
var _sno = MAXX(ALLEXCEPT('Test Data','Test Data'[Test Type]),[Test Value])
return
SWITCH(TRUE(),
SELECTEDVALUE('Car Type'[Car Type])=BLANK() &&SELECTEDVALUE(Colour[Colour])=BLANK(),_sno,
SELECTEDVALUE('Car Type'[Car Type])=BLANK() &&SELECTEDVALUE(Colour[Colour])<>BLANK(),_scol,
SELECTEDVALUE('Car Type'[Car Type])<>BLANK() &&SELECTEDVALUE(Colour[Colour])=BLANK(),_scar,
_sboth)

 

 

 

 

11.PNG22.PNG

 

 

If I misunderstood your meaning, please provide your desired output.

 

Best Regards

Community Support Team _ Polly

 

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

 

amitchandak
Super User
Super User

@JFG123 , Try if this can help

calculate(Max(Table[Test Value]), allselected())

 

or

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

I have included a sample Pbix file.

 

The provided soln does not assist, it does not account for;

1. if different names are selected the value changes to reflect the data in the table

2. Doesn't account for the different test type grouping structure

 

I have added the below image to assist with the interpretation (based on simple sample data). In the initial portion the select for car type is yarris and colour is all. The comparison value is calculated by test type for the data in the table, with no filter on name.

 

The second portion, shows what should happen after filtering for just JOHN, with the same filters as before, the comparison value shouldnt change just because the name has been filtered down.

 

JFG123_0-1639626640738.png

 

 

 

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.