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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
avatar456
Helper I
Helper I

Using multiple selections from slicer in measure

Hello, 

 

I would like to display the average of a column in my dashboard. In doing so, I filter my data by group.
When I select 1 group my formula works perfectly, as soon as I select more than one it does not work.


I would like to have an IF statement in my formula that checks if the slicer contains 1 or more values. If the slicer would then contain multiple values, I want to display the average of the entire data set 

 

Current formula: 

Mean = CALCULATE(GEOMEANX(Attitude, Attitude[total]), FILTER(data, data[group] = VALUES(data[group])))

 

What I would expect as a formula: 

Mean = IF(SELECTEDVALUE(data[group] = "Multiple selections"), GEOMEANX(Attitude, Attitude[total]), CALCULATE(GEOMEANX(Attitude, Attitude[total]), FILTER(data, data[group] = SELECTEDVALUE(data[group]))))

 

Thanks for helping me out! 

 

1 ACCEPTED SOLUTION
mangaus1111
Solution Sage
Solution Sage

Hi @avatar456 ,

try this, it should work with single or multile selections.

Mean = CALCULATE(GEOMEANX(Attitude, Attitude[total]), FILTER(data, data[group]  IN VALUES(data[group])))

 

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

View solution in original post

4 REPLIES 4
v-shex-msft
Community Support
Community Support

Hi @avatar456,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
mangaus1111
Solution Sage
Solution Sage

Hi @avatar456 ,

try this, it should work with single or multile selections.

Mean = CALCULATE(GEOMEANX(Attitude, Attitude[total]), FILTER(data, data[group]  IN VALUES(data[group])))

 

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

mangaus1111
Solution Sage
Solution Sage

Hi @avatar456 ,

maybe using the function HASONEVALUE.

 

Mean = IF(

          HASONEVALUE(data[group]),

CALCULATE(GEOMEANX(Attitude, Attitude[total]), FILTER(data, data[group] = SELECTEDVALUE(data[group])),

GEOMEANX(Attitude, Attitude[total])

)

 

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

@mangaus1111 thank you for your answer. 

 

I get the following error, any idea? 

avatar456_0-1667228282761.png

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.