Forum Discussion

nexaframe's avatar
nexaframe
Frequent Visitor
4 years ago
Solved

Calculate Value Change / Value Difference between given Dates

Hello Community, as I could not find any answer here or on other platforms, I would like to get your support with my first contribution:   I have a dataset of stock reports looking basically like ...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi nexaframe ,

    Please refer to my pbix file to see if it helps you.

    Create  a table.

    Table 2 = VALUES('Table'[ReportDate])

    Then put the table 2 [reportdate] into the column filed.

    Create two measures.

    Measure =
    VAR _oreplrblank =
        CALCULATE (
            MAX ( 'Table'[Value] ),
            FILTER (
                ALLSELECTED ( 'Table' ),
                'Table'[Type]
                    IN VALUES ( 'Table'[Type] )
                        && 'Table'[ReportDate] IN VALUES ( 'Table 2'[ReportDate] )
            )
        )
    VAR _harereplace =
        IF ( _oreplrblank = BLANK (), 0, _oreplrblank )
    RETURN
        _harereplace
    
    Measure_2 =
    VAR _DATEBEFORE =
        CALCULATE (
            MAX ( 'Table 2'[ReportDate] ),
            FILTER (
                ALL ( 'Table 2' ),
                'Table 2'[ReportDate] < MAX ( 'Table 2'[ReportDate] )
            )
        )
    VAR _VALUEBEFORE =
        CALCULATE (
            [Measure],
            FILTER ( ALL ( 'Table 2' ), 'Table 2'[ReportDate] = _DATEBEFORE )
        )
    RETURN
        [Measure] - _VALUEBEFORE
    

     

    Best Regards

    Community Support Team _ Polly

     

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