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
dkernen
Resolver II
Resolver II

How to create a slicer with levels of criteria

I would like to create a slicer that allows me to select all records, meets one criteria, and meets both criteria.

 

I have one field that has 1/0 values that defines "Good" as an example.

 

I have another field that also has 1/0 values that defines "Excellent."

 

I want the ability to have a slicer that allows me to select All, Good, and Excellent.  Every record that is Excellent (=1) also has the Good (=1) criteria.  I have no interest in selecting anyone who is not good and I don't need to select anyone who is good, but not Excellent.  When I select All, I don't care if they are good or not.  When I select Good, I don't care if they are also flagged as Excellent.  

 

Say I have 100 records, 40 of them are good, and 15 of those are both good and Excellent.  So I want the slicer to allow me to choose the 100 OR the 40 OR the 15.  I do not need the residuals.  The Good are a subset of All and the Excellent are a subset of the Good.

 

Do I create a hierarchy?  Do I have to create a new column?   I am not sure how to solve this.  I appreciate any insight you may be able to share.

 

@slicer, @hierarchy

2 ACCEPTED SOLUTIONS

@dkernen ,

 

Create a unrelated table with:

SlicerID

All 1
Good 2
Excellent 3

 

Now add the following measure:

Slicer_Filter =
SWITCH (
    SELECTEDVALUE ( Slicer[ID] ),
    1, 1,
    2,
        CALCULATE (
            MAX ( 'Dimension'[Excellent] ),
            FILTER ( 'Dimension', 'Dimension'[Excellent] = 1 )
        ),
    3,
        CALCULATE (
            MAX ( 'Dimension'[Good] ),
            FILTER ( 'Dimension', 'Dimension'[Good] = 1 )
        )
)

 

Now use this to filter out your table making the value greater than 0.

 

Check PBIX file attach.


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

Hi @dkernen ,

 

Measures are based in context, so in your case what is happening is that the two visuals on the left are not related with the context of the measure you are using as filter,

 

The measure refers to the table 'dimODisp' however both of your visualizations do not relate directly with this table. The calculation of the sum need to be redone accordingly to the selection so you would need to redo the cases to:

SUM_CASES_V2 = 
SWITCH (
    SELECTEDVALUE ( 'MTN Organ Subset'[ID] ),
    1,  SUM(factCase[AnyCase]),
    2,
        CALCULATE (
            SUM(factCase[AnyCase]),
            FILTER (SUMMARIZE(factCase,factCase[Referral_ID], dimODisp[OMTNImminentDeath_N]) , 'dimODisp'[OMTNImminentDeath_N] = 1 )
        ),
    3,
        CALCULATE (
            SUM(factCase[AnyCase]),
            FILTER (SUMMARIZE(factCase,factCase[Referral_ID], dimODisp[OMTNConvDenom_N]) ,  'dimODisp'[OMTNConvDenom_N] = 1 )
        )
)

 

Has you can see on the Facility short name now the calculation changes with the selection of the slicer. Be aware that I have made the calculation but not sure if this is what you need, please check the numbers.

 

For the 1st visualization (not yet changed you need to probably replace the CASES measure by the one I have calculated above.

 


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

8 REPLIES 8
MFelix
Super User
Super User

Hi @dkernen ,

 

If the cruiteria level is on column you just need to place that column in a slicer and then uzse it as your slicer.

 

can you please share a small sample of your data? especcially the items that are not within your criterias.


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



Sure!  

 

DIMENSION

CaseIDGoodExcellent
A10
B11
C00
D00
E00
F00
G00
H11
I10
J11
K00
L00
M10
N00
O11
P00

 

FACT

CaseIDAmount
A10
A12
B5
B6
C7
C8
D12
D45
E50
E12
F43
F15
F15
G1
G7
G8
H25
H20
H45
I13
I150
J12
J4
K8
K7
L14
M16
N18
O20
P21

@dkernen ,

 

Create a unrelated table with:

SlicerID

All 1
Good 2
Excellent 3

 

Now add the following measure:

Slicer_Filter =
SWITCH (
    SELECTEDVALUE ( Slicer[ID] ),
    1, 1,
    2,
        CALCULATE (
            MAX ( 'Dimension'[Excellent] ),
            FILTER ( 'Dimension', 'Dimension'[Excellent] = 1 )
        ),
    3,
        CALCULATE (
            MAX ( 'Dimension'[Good] ),
            FILTER ( 'Dimension', 'Dimension'[Good] = 1 )
        )
)

 

Now use this to filter out your table making the value greater than 0.

 

Check PBIX file attach.


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



 I see how yours works beautifully.  Thank you.  

 

Originally, my slicer didn't do anything at all.  Then I realized that my key needs to come from the dimension not the fact table.  I also see now that I need to have the fields used for the slicer somewhere in each visual which references (tooltip, additional columns in the matrix, etc)

 

Thank you for your help.

 

Hi @dkernen

 

You just need to place the measure on the filters pane of the visualization and filter it to above 0 no need to add it to the visualization itself so the additional data is not seen. 


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



@MFelix 

 

Thank you for your help.  I still don't understand why the disconnected table works on some visuals but not others.

 

https://mwtn-my.sharepoint.com/:u:/g/personal/dkernen_mwtn_org/EaW79dQSTjxGuWMVZJ_-pkcBTWKG8jAhNwp_w...  On the Duplicate tab, I have the new slicer.  The right two visuals adjust based on the slicer, but the left two do not. 

 

Any other words of wisdom?  You've been tremendously helpful!

Hi @dkernen ,

 

Measures are based in context, so in your case what is happening is that the two visuals on the left are not related with the context of the measure you are using as filter,

 

The measure refers to the table 'dimODisp' however both of your visualizations do not relate directly with this table. The calculation of the sum need to be redone accordingly to the selection so you would need to redo the cases to:

SUM_CASES_V2 = 
SWITCH (
    SELECTEDVALUE ( 'MTN Organ Subset'[ID] ),
    1,  SUM(factCase[AnyCase]),
    2,
        CALCULATE (
            SUM(factCase[AnyCase]),
            FILTER (SUMMARIZE(factCase,factCase[Referral_ID], dimODisp[OMTNImminentDeath_N]) , 'dimODisp'[OMTNImminentDeath_N] = 1 )
        ),
    3,
        CALCULATE (
            SUM(factCase[AnyCase]),
            FILTER (SUMMARIZE(factCase,factCase[Referral_ID], dimODisp[OMTNConvDenom_N]) ,  'dimODisp'[OMTNConvDenom_N] = 1 )
        )
)

 

Has you can see on the Facility short name now the calculation changes with the selection of the slicer. Be aware that I have made the calculation but not sure if this is what you need, please check the numbers.

 

For the 1st visualization (not yet changed you need to probably replace the CASES measure by the one I have calculated above.

 


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



Stunning.  Wow.  @MFelix  is my Superhero!   Thank you thank you thank you!!!!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.