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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
ohojames
Frequent Visitor

How to filter a measure by multiple values

Hi folks,

 

I'd like to get multiple selected values from slicer  to apply in a measure. 

I'm now using a SELECTEDVALUE() which is not working for multiple values, please suggest on this issue.

 

attractionSummary = 
var visualType = SELECTEDVALUE('A'[data_type])   // how to get multiple selected values from slicer
RETURN
    CALCULATE(SUM('A'[date_publish_all]),
        FILTER(ALL('A'), 'A'[datekey] = MAX('A'[datekey])
                && 'A'[actor_id]=1
                    &&'A'[data_type]=visualType))

 

 

Thank you in advance

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @ohojames,

 

To what I can see from your measure all the filters are made based on the same table so the filter option is not needed to have it based on your filter. When you have a slicer based on a table all the information is filter from your measures and visuals accordingly so by default you are already making selected values.

 

Based on your measure and if you have a slicer from table 1 for datatype & datekey your measure should look something like this:

 

attractionSummary =
VAR datekey =
    MAX ( ALL ( 'A'[datekey] ) )
RETURN
    CALCULATE (
        SUM ( 'A'[date_publish_all] ),
        'A'[datekey] = datekey
            && 'A'[actor_id] = 1
    )

No need to place the data_type in your filter since you are getting the only selected values from your filter to make the calculations

 

Can you share some data, model setup and expected result.

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @ohojames,

 

To what I can see from your measure all the filters are made based on the same table so the filter option is not needed to have it based on your filter. When you have a slicer based on a table all the information is filter from your measures and visuals accordingly so by default you are already making selected values.

 

Based on your measure and if you have a slicer from table 1 for datatype & datekey your measure should look something like this:

 

attractionSummary =
VAR datekey =
    MAX ( ALL ( 'A'[datekey] ) )
RETURN
    CALCULATE (
        SUM ( 'A'[date_publish_all] ),
        'A'[datekey] = datekey
            && 'A'[actor_id] = 1
    )

No need to place the data_type in your filter since you are getting the only selected values from your filter to make the calculations

 

Can you share some data, model setup and expected result.

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.