Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
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.
I have attached sample data in a pbix here: https://drive.google.com/file/d/1ib0FAGD-6xt_GueJs-aWzCBtI2bAV9Hm/view?usp=sharing
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.
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)
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.
@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.
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.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
94 | |
92 | |
83 | |
71 | |
49 |
User | Count |
---|---|
143 | |
120 | |
110 | |
59 | |
57 |