Forum Discussion

Brian415_'s avatar
Brian415_
Frequent Visitor
2 years ago
Solved

Priority Rules / Column in Table Visualisation

Hi all,    I am currently developing a dashboard in Power BI and encountering an issue with displaying data based on priority rules for categories. Allow me to explain my situation in detail:   S...
  • tharunkumarRTK's avatar
    2 years ago

    Brian415_ 

    Create a dedicated table with unique values of product and do not create any relation between product list table and the actual data table. Put the product column from product list into the slicer create a measure using the below pattern.

    Condition_Check = 
    Var SelectedProductCategories = CALCULATETABLE(VALUES('Data Table'[Category]), 'Data Table'[Product] = SELECTEDVALUE(ProductsTable[Product]),  ALLSELECTED('Data Table')) 
    Var __Condition = SWITCH( TRUE(),
        COUNTROWS( EXCEPT(SelectedProductCategories, {"A"})) = 0 , "A",
        COUNTROWS( EXCEPT(SelectedProductCategories, {"A","B"})) = 0 , "A",
        COUNTROWS( EXCEPT(SelectedProductCategories, {"B"})) = 0 , "B",
        COUNTROWS( EXCEPT(SelectedProductCategories, {"B","C"})) = 0 , "B",
        COUNTROWS( EXCEPT(SelectedProductCategories, {"C"})) = 0 , "C"
    )
    Var result = IF(SELECTEDVALUE('Data Table'[Category]) = __Condition && SELECTEDVALUE(ProductsTable[Product]) = selectedvalue('Data Table'[Product]), 1, 0)
    return result 

     You should use this meausre as a visual lelvel filter. I am attaching the file for your reference.

     


    If the post helps please give a thumbs up


    If it solves your issue, please accept it as the solution to help the other members find it more quickly.


    Tharun