Forum Discussion

ARVINDlsllp's avatar
ARVINDlsllp
Frequent Visitor
2 years ago
Solved

QlikView Expression into Power measures

Hello All,   I want to use this Qlikview Expresiion i:-   =if(GetSelectedCount(REGIME)=0, sum({<Year={$(=max(Year))},REGIME={'C*'},Flag={'B'}>}DUTY)+sum({<Year={$(=max(Year))},Flag={'C'}>}DUTY),...
  • Anonymous's avatar
    Anonymous
    2 years ago

    HI ARVINDlsllp,

    You can try to use the following measure formula if it helps with your scenario:

    formula =
    VAR currYear =
        MAX ( 'YourTable'[Year] )
    RETURN
        CALCULATE (
            SUM ( 'YourTable'[DUTY] ),
            FILTER (
                ALLSELECTED ( 'YourTable' ),
                IF (
                    COUNTROWS ( ALLSELECTED ( 'YourTable'[REGIME] ) ) = 0,
                    OR (
                        AND (
                            'YourTable'[Year] = currYear,
                            SEARCH ( "C*", 'YourTable'[REGIME], 1, -1 ) > 0
                                && 'YourTable'[Flag] = "B"
                        ),
                        AND ( 'YourTable'[Year] = currYear, 'YourTable'[Flag] = "C" )
                    ),
                    AND ( 'YourTable'[Year] = currYear, 'YourTable'[Flag] IN { "B", "C" } )
                )
            )
        )

    Regards,

    Xiaoxin Sheng