Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Results for multiple categories

Hi All,
I have a category column in my table that is Either ETL or Manual, that represents wether a row comes directly from the ETL process or through a manual upload. Each row will have a corresponding value, split by KPI Type category column as shown in the attached.

The problem I'm having is that if for a given month and KPI Type there is an row in the category column for ETL I want to see only that, if there is a row for both ETL and Manual, then only return ETL but if there is only a row for Manual then return that. 

My current measure is this, however it isn't returning the manual rows.

Combined Value =

VAR BothCategories = CALCULATE(SUM(F_WIND_KPI_MONTHLY[VALUE]), F_WIND_KPI_MONTHLY[Manual Flag] in {"ETL","M"},F_WIND_KPI_MONTHLY[ENTITY_CODE]=F_WIND_KPI_MONTHLY[SITE_CODE])
VAR ETL = CALCULATE(SUM(F_WIND_KPI_MONTHLY[VALUE]), F_WIND_KPI_MONTHLY[Manual Flag] = "ETL" && NOT(F_WIND_KPI_MONTHLY[Manual Flag] = "M"),F_WIND_KPI_MONTHLY[ENTITY_CODE] = F_WIND_KPI_MONTHLY[SITE_CODE])
VAR OnlyManual = CALCULATE(SUM(F_WIND_KPI_MONTHLY[VALUE]), F_WIND_KPI_MONTHLY[Manual Flag] = "M" && NOT(F_WIND_KPI_MONTHLY[Manual Flag] = "ETL"))
RETURN
    IF(BothCategories > 0, ETL, IF(OnlyManual > 0, OnlyManual, ETL))





  • Use this updated measure to prioritize ETL rows and return Manual rows only if ETL is absent:

    Combined Value =
    VAR HasETL = CALCULATE(SUM(F_WIND_KPI_MONTHLY[VALUE]), F_WIND_KPI_MONTHLY[Manual Flag] = "ETL")
    VAR HasManual = CALCULATE(SUM(F_WIND_KPI_MONTHLY[VALUE]), F_WIND_KPI_MONTHLY[Manual Flag] = "M")
    RETURN IF(HasETL > 0, HasETL, HasManual)

     

     

    This ensures ETL rows take precedence, and Manual rows are included only when ETL is absent.

1 Reply

  • Use this updated measure to prioritize ETL rows and return Manual rows only if ETL is absent:

    Combined Value =
    VAR HasETL = CALCULATE(SUM(F_WIND_KPI_MONTHLY[VALUE]), F_WIND_KPI_MONTHLY[Manual Flag] = "ETL")
    VAR HasManual = CALCULATE(SUM(F_WIND_KPI_MONTHLY[VALUE]), F_WIND_KPI_MONTHLY[Manual Flag] = "M")
    RETURN IF(HasETL > 0, HasETL, HasManual)

     

     

    This ensures ETL rows take precedence, and Manual rows are included only when ETL is absent.