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
Ncio
Helper II
Helper II

Measure slicer: sum when multiple selection?

Hello,

 

I've implemented a "measure slicer" that works well: using the slicer, I can select one mesure. 

 

I have a table with the values "filter1", "filter2", "filter3" that I use in a slicer.

And I use the following measure (simplified): 

Graph: Slicer Cumul annuel =
IF(HASONEFILTER('KPI: Slicer'[Type]),
SWITCH(SELECTEDVALUE('KPI: Slicer'[Type]),
"filter1", [KPI1],
"filter2", [KPI2],
"filter3", [KPI3],
),
BLANK()
)

 

==> Now, i'd like to be able to select multiple values in the slicer, and it would sum all selected mesures.

  • For instance, if I select "filter1" and "filter2" using the slicer, i'd like to have KPI1 + KPI2
  • Currently,
    • because of "HASONEFILTER", no calculations are done if I have more that one filter.
    • And "SELECTEDVALUE" works only if there is only one value.

Thank you,

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Ncio , try like

 

Graph: Slicer Cumul annuel =
calculate(

if(countx(filter('KPI: Slicer'[Type] , 'KPI: Slicer'[Type] = "filter1"),'KPI: Slicer'[Type] )+0 > 0, [KPI1],0)+
if(countx(filter('KPI: Slicer'[Type] , 'KPI: Slicer'[Type] = "filter2"),'KPI: Slicer'[Type] )+0 > 0, [KPI2],0)+
if(countx(filter('KPI: Slicer'[Type] , 'KPI: Slicer'[Type] = "filter3"),'KPI: Slicer'[Type] )+0 > 0, [KPI3],0)
)

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

View solution in original post

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Hi, @Ncio 

Please check the below picture and the sample pbix file's link down below.

The left side chart is the single selection, and the right side chart is the multi-selection (Sum).

Once you multi-select the slicer, the left chart will go back to the default, and the right chart will sum the selected measures.

All measures are in the sample pbix file.

 

Picture2.png

 

https://www.dropbox.com/s/n1hwfr92e4ib8v9/diffaaa.pbix?dl=0 

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

MikeJohnsonZA
Responsive Resident
Responsive Resident

Assuming that all your measures return numbers you should be able to do something like

 

New Measure = sumx(values('measure slicer'[measure]),[Slicer Cumul annel])

 

This pattern might not perform very well as you add more visuals, measures or data to the report but should work.

 

 

 

amitchandak
Super User
Super User

@Ncio , try like

 

Graph: Slicer Cumul annuel =
calculate(

if(countx(filter('KPI: Slicer'[Type] , 'KPI: Slicer'[Type] = "filter1"),'KPI: Slicer'[Type] )+0 > 0, [KPI1],0)+
if(countx(filter('KPI: Slicer'[Type] , 'KPI: Slicer'[Type] = "filter2"),'KPI: Slicer'[Type] )+0 > 0, [KPI2],0)+
if(countx(filter('KPI: Slicer'[Type] , 'KPI: Slicer'[Type] = "filter3"),'KPI: Slicer'[Type] )+0 > 0, [KPI3],0)
)

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

Works perfectly, thanks!

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.