Forum Discussion

SowjanyaB's avatar
SowjanyaB
Frequent Visitor
1 year ago
Solved

Display one among two table visual based on a column value

We are migrating reports from OBIEE to Power BI. In OBIEE, there conditional sections which will display particular table visual if the criteria is met.

Scenario : The employees will be listed using a slicer. The end users will chosse an employee name from the slicer. All the employees are part of one of two groups. The business for each group is different here, so there will be two table visuals and will be displayed to end users based on their group.

How to achieve this functionality in Power BI?

  • Hi,

    I am not sure how the expected outcome looks like, but I tried to create a sample pbix file like below.

    Please check the below picture and the attached pbix file.

     

     

     

     

    sales: = 
    VAR _salesa =
        SUM ( group_a[sales] )
    VAR _salesb =
        SUM ( group_b[sales] )
    VAR _employeeselect =
        VALUES ( slicer_employee[employee] )
    RETURN
        SWITCH (
            TRUE (),
            COUNTROWS ( FILTER ( ALL ( group_a ), group_a[employee] IN _employeeselect ) ) > 0
                && COUNTROWS ( FILTER ( ALL ( group_b ), group_b[employee] IN _employeeselect ) ) = 0, _salesa,
            COUNTROWS ( FILTER ( ALL ( group_a ), group_a[employee] IN _employeeselect ) ) = 0
                && COUNTROWS ( FILTER ( ALL ( group_b ), group_b[employee] IN _employeeselect ) ) > 0, _salesb,
            _salesa + _salesb
        )

     

     

    background color condition: = 
    VAR _employeeselect =
        VALUES ( slicer_employee[employee] )
    RETURN
        IF (
            COUNTROWS ( INTERSECT ( VALUES ( employee[employee] ), _employeeselect ) ) > 0,
            "Yellow"
        )

     

2 Replies

  • Hi,

    I am not sure how the expected outcome looks like, but I tried to create a sample pbix file like below.

    Please check the below picture and the attached pbix file.

     

     

     

     

    sales: = 
    VAR _salesa =
        SUM ( group_a[sales] )
    VAR _salesb =
        SUM ( group_b[sales] )
    VAR _employeeselect =
        VALUES ( slicer_employee[employee] )
    RETURN
        SWITCH (
            TRUE (),
            COUNTROWS ( FILTER ( ALL ( group_a ), group_a[employee] IN _employeeselect ) ) > 0
                && COUNTROWS ( FILTER ( ALL ( group_b ), group_b[employee] IN _employeeselect ) ) = 0, _salesa,
            COUNTROWS ( FILTER ( ALL ( group_a ), group_a[employee] IN _employeeselect ) ) = 0
                && COUNTROWS ( FILTER ( ALL ( group_b ), group_b[employee] IN _employeeselect ) ) > 0, _salesb,
            _salesa + _salesb
        )

     

     

    background color condition: = 
    VAR _employeeselect =
        VALUES ( slicer_employee[employee] )
    RETURN
        IF (
            COUNTROWS ( INTERSECT ( VALUES ( employee[employee] ), _employeeselect ) ) > 0,
            "Yellow"
        )

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi SowjanyaB ,

    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 and description to help us clarify your scenario to test.

    How to Get Your Question Answered Quickly 

    Regards,

    Xiaoxin Sheng