Forum Discussion

CasperSV's avatar
CasperSV
Helper II
3 years ago
Solved

Power BI Matrix

Hi guys,   I have made a Matrix in Power BI, however it should exclude the type Forecast as soon as the type Sales order (named order in report) has the same amount.    Current result:   ...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi CasperSV ,

    Please replace before measure with below dax formula:

    Available per week (Switch) =
    VAR _a =
        CALCULATE (
            [Mutations this week],
            FILTER ( ALL ( Lines ), [Type] = "Forecast" )
        )
    VAR _b =
        CALCULATE ( [Mutations this week], FILTER ( ALL ( Lines ), [Type] = "Order" ) )
    VAR _c =
        IF (
            MAX ( 'Lines'[Type] ) = "Forecast"
                && _a = _b,
            BLANK (),
            [Mutations this week]
        )
    RETURN
        SWITCH (
            TRUE (),
            ISINSCOPE ( 'Lines'[Type] ), _c,
            ISINSCOPE ( 'Lines'[Item number] ),
                IF (
                    _a = _b,
                    [Available quantity per week] - _a,
                    [Available quantity per week]
                ),
            BLANK ()
        )
    

    Please refer the attached .pbix file.

     

    Best regards,
    Community Support Team_ Binbin Yu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.