Forum Discussion

Iam_Syed's avatar
Iam_Syed
Regular Visitor
6 months ago
Solved

When values duplicate then green when unique then Red

Hi Team,

 

I am stuck for creating a calculation but lo luck, please help on this.

 

In this table has Row = Category (Text)

                          Column = Type (Text)

                          Values = sum of sales (Numeric)

I want to show this table values when duplicate then Green color if Unique the Red color.                           

 

Category S1S2S3
Mobile113113114
Laptop113311331134
Desktop221111222211
Furniture110111021101

 

 

Thanks

Syed

  • hi Iam_Syed ,

     

    Not sure if i fully get you, supposing you have a data table like:

     

    try to plot your expected matrix visual and apply conditional formatting for the value field background based field value with a measure like below:

    Measure = 
    VAR _cat = MAX(data[category])
    VAR _type = MAX(data[type])
    VAR _table =
        ADDCOLUMNS(
            SUMMARIZE(
                FILTER(
                    ALL(data),
                    data[category] = _cat && data[type] <> _type
                ),
            data[category], data[type]
            ),
            "Amt",
            CALCULATE(SUM(data[sales]))
        )
    VAR _AmtList = SUMMARIZE(_table, [Amt])
    VAR _result = IF([SalesAmt] IN _AmtList, "Green", "Red")
    RETURN _result

     

    it works like:

     

  • Irwan's avatar
    Irwan
    6 months ago

    hello Iam_Syed 

     

    for subtotal, just tick either column or row subtotal or both depend on your need.

     

    Thank you.