Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

comparing current year with last year

Hi guys,      I am new to power bi i want to compare the current year with Last Year. I am Having data from 2017 january to 2019 November. I have connected through Live Cube data. I have used a for...
  • v-joesh-msft's avatar
    6 years ago

    Hi Anonymous ,

    Replace ALLSELECTED in the formula with ALL to see if it works, or you can try the following measure:

    Current Year =
    CALCULATE (
        SUM ( 'Table1'[TotalAmount] ),
        FILTER ( ALL ( 'Table1' ), Table1[Date].[Year] = MAX ( Table1[Date].[Year] ) )
    )
    Last_year =
    CALCULATE (
        SUM ( 'Table1'[TotalAmount] ),
        FILTER (
            ALL ( 'Table1' ),
            Table1[Date].[Year]
                = MAX ( Table1[Date].[Year] ) - 1
        )
    )

    If it doesn't meet your requirement, kindly share your sample data if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

    Best Regards,
    Community Support Team _ Joey
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.