Forum Discussion

venstart's avatar
venstart
Frequent Visitor
5 years ago
Solved

Power BI On Screen Filtered Calculation

Hi There people   I need need your help. So I created a power bi dashboard, below is the screenshot. I have added a date slicer so that the data will be dynamic.  I am happy with the "Opening Stock...
  • v-lionel-msft's avatar
    5 years ago

    Hi venstart ,

     

    Please do like this.

    For "Harv Minus Sales":

    M1 = 
    VAR x = SUMX( FILTER( ALLSELECTED('Parent List'), [FormMode] = "Sales Log" ), [OData_6-6.6m19cm] )
    VAR y = SUMX( FILTER( ALLSELECTED('Parent List'), [FormMode] = "Harvesting Log" ), [OData_6-6.6m19cm] )
    RETURN
    y-x
    M2 = 
    VAR x = SUMX( FILTER( ALLSELECTED('Parent List'), [FormMode] = "Sales Log" ), [OData_6-6.6m25cm] )
    VAR y = SUMX( FILTER( ALLSELECTED('Parent List'), [FormMode] = "Harvesting Log" ), [OData_6-6.6m25cm] )
    RETURN
    y-x
    ...

    For "Theoretical Month End Stock" :

    Measure = 
    VAR x = 
    CALCULATE(
        SUM('Parent List'[OData_6-6.6m19cm]),
        FILTER( Table1, [Column] = "Opening Stock")
    )
    RETURN
    x + [M1]
    ...

     

    Best regards,
    Lionel Chen

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.