Forum Discussion

osmagar26's avatar
osmagar26
New Member
3 years ago
Solved

Use information from one filter inside another filter

Hi everyone, i need help with something that might be simple but im struggling a bit.

 

I need to be able to use the information from one filter in Power BI and then add that info another result.

 

Let me show you in a better way:

Table 1:

 

IDPeopleSex
3215845Female
3365944Male
3489843Organization

 

Table 2:

 

OrganizationMaleFemale
348984826

 

I have this data... where each row has an unique ID but as you can see there is female, male, organization. I need to know how to add just male and female info and the organization info distributed into male or female in a DAX function.

 

I tried this Power BI dax function but is not working =
VAR organization_male = CALCULATE(_nvaluemale, Sex(sex)="Organization")

VAR organization_female = CALCULATE(_nvaluefemale, Sex(sex)="Organization")

 

And then i made a selectedvalue or hasonefilter function depending on the selection in the slicer as this:

 

IF(HASONEFILTER(Sex(sex),
SWITCH(VALUES(Sex(sex),

"Female", organization_female

"Male", organization_male)

 

However is it not working since it is getting invalid due to i filter previously above where i used sex(sex)="Organization". It just showed me a blank card.

 

I just need to know how to distribute the organization members into male and female and have just those 2 options(male, female) without showing the organization option list. 

 

I hope this was clear.

 

Could you please help me on this??

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi osmagar26 ,

    What is your desired output? When you select "Female", what will appear in table 2? 

    Organization   Female
    34898   26

    Like the above? 

     

    When you select "Male", what will appear in table 2? 

    Organization Male  
    34898 48  

    Also like the above?

     

    I have created a simple sample, please refer to it.
    Create a measure.

    Measure = var _selected=SELECTEDVALUE('Table'[Sex])
    return
    IF(_selected=MAX('Table (2)'[Attribute])||MAX('Table (2)'[Attribute])="Organization",1,0)

    Then filter the measure is 1.

    How to Get Your Question Answered Quickly 

     

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

     

    Best Regards
    Community Support Team _ Polly

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

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi osmagar26 ,

    What is your desired output? When you select "Female", what will appear in table 2? 

    Organization   Female
    34898   26

    Like the above? 

     

    When you select "Male", what will appear in table 2? 

    Organization Male  
    34898 48  

    Also like the above?

     

    I have created a simple sample, please refer to it.
    Create a measure.

    Measure = var _selected=SELECTEDVALUE('Table'[Sex])
    return
    IF(_selected=MAX('Table (2)'[Attribute])||MAX('Table (2)'[Attribute])="Organization",1,0)

    Then filter the measure is 1.

    How to Get Your Question Answered Quickly 

     

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

     

    Best Regards
    Community Support Team _ Polly

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