Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Summing an IF Statement

Hi Community!    I am looking to create an accurate Sum total column (see highlighted totals below):   This Gaps closed measure is:    Gaps Closed = IF([Total Qty Baseline]= 0, 1, 0)     ...
  • johnt75's avatar
    johnt75
    3 years ago

    The table you use to iterate over in the SUMX needs to match the values you are showing in the visual, so it needs enough columns to uniquely identify each row in the visual. If you have a fact table holding sales, and dimension tables holding other columns you could do something like

    Gaps Closed =
    SUMX (
        SUMMARIZE (
            'Sales',
            'Territory'[Territory Code],
            'Customer'[Customer number],
            'Items'[Item number]
        ),
        IF ( [Total Qty Baseline] = 0, 1, 0 )
    )