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.
the slicer is the distinct value of column type and is setted as singal select,
"Default" is the value that every id has, but other type may not, for example when id is B there is no value other than "Default".
here is the situation to be solved: when slicer is "Default", all values of column id return relevant rows,
and when slicer is not "Default", the id did not has other value return the "default" row and the id did not has default "default" return selected relevant row to be calculated
for example, when slicer is "Senior", id A returns type=Senior row and id B returns type=Default row
do you have any solutions to realize such a slicer?
Thank you.
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
One of ways to achieve this is to have disconnected slicer like below, and create measures like below.
Amount measure: =
VAR _slicerselect =
SELECTEDVALUE ( Slicer[Type], "Default" )
VAR _result =
CALCULATE ( SUM ( Data[Amount] ), KEEPFILTERS ( Data[Type] = _slicerselect ) )
RETURN
IF (
HASONEVALUE ( Data[ID] ),
IF (
ISBLANK ( CALCULATE ( SUM ( Data[Amount] ), Data[Type] = _slicerselect ) ),
CALCULATE ( SUM ( Data[Amount] ), KEEPFILTERS ( Data[Type] = "Default" ) ),
_result
)
)
Percentage measure: =
VAR _slicerselect =
SELECTEDVALUE ( Slicer[Type], "Default" )
VAR _result =
CALCULATE ( SUM ( Data[Ratio] ), KEEPFILTERS ( Data[Type] = _slicerselect ) )
RETURN
IF (
HASONEVALUE ( Data[ID] ),
IF (
ISBLANK ( CALCULATE ( SUM ( Data[Ratio] ), Data[Type] = _slicerselect ) ),
CALCULATE ( SUM ( Data[Ratio] ), KEEPFILTERS ( Data[Type] = "Default" ) ),
_result
)
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
very good solution, I wonder if these is a way to add such a measure as slicer to achieve that result
Hi,
Please check the below picture and the attached pbix file.
One of ways to achieve this is to have disconnected slicer like below, and create measures like below.
Amount measure: =
VAR _slicerselect =
SELECTEDVALUE ( Slicer[Type], "Default" )
VAR _result =
CALCULATE ( SUM ( Data[Amount] ), KEEPFILTERS ( Data[Type] = _slicerselect ) )
RETURN
IF (
HASONEVALUE ( Data[ID] ),
IF (
ISBLANK ( CALCULATE ( SUM ( Data[Amount] ), Data[Type] = _slicerselect ) ),
CALCULATE ( SUM ( Data[Amount] ), KEEPFILTERS ( Data[Type] = "Default" ) ),
_result
)
)
Percentage measure: =
VAR _slicerselect =
SELECTEDVALUE ( Slicer[Type], "Default" )
VAR _result =
CALCULATE ( SUM ( Data[Ratio] ), KEEPFILTERS ( Data[Type] = _slicerselect ) )
RETURN
IF (
HASONEVALUE ( Data[ID] ),
IF (
ISBLANK ( CALCULATE ( SUM ( Data[Ratio] ), Data[Type] = _slicerselect ) ),
CALCULATE ( SUM ( Data[Ratio] ), KEEPFILTERS ( Data[Type] = "Default" ) ),
_result
)
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
111 | |
92 | |
84 | |
66 |