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

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.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.