Forum Discussion

AndreiiBC's avatar
AndreiiBC
Frequent Visitor
2 years ago
Solved

Flag all IDs from a certain category

Hello, I had a separate topic here which I didn't find a solution for but I was thinking I can do things in a different way so the problem is:   I want to flag all the ID's from a certain category...
  • ekoland's avatar
    2 years ago

    First image is without any selection in the slicer. As you can see the flag is working fine for the Products that have Details as "Discounted".

    Second image AAA2 product is selected and the flag shows 0 for everything.
    Third Image  AAA3 product is selected amd the flag shows 1 for AAA3.

    I hope that this will help you or a least drive you to the right path!

     

     

  • ekoland's avatar
    ekoland
    2 years ago

    Try this:

    Flag = 
    VAR _table =
        SUMMARIZE (
            'Fact',
            'Fact'[ProductID],
            dim[Subcategory],
            dim[Details],
            "new column", IF(CONTAINSSTRING(dim[Details],"Discounted"),1,0))
        
    VAR _flag= IF(MAXX(SUMMARIZE(_table,dim[Subcategory],[new column]),[new column])=1,"Discounted","Non Discounted")
    RETURN
        _flag

    Now if a product has "Discounted" the entire Subcategory is "Discounted".