Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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 formula
But when i click the Year filter say 2018 i must compare the 2018 and 2017 values but instead the Last year value becomes blank. I have tried using SAMEPERIODLASTYEAR Function also but the same issue is obtained. please help me with it and provide me a solution.
Solved! Go to Solution.
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.
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.
@v-joesh-msft Hi ,
Thanks for your help. I have got it and could you tell me for calculating month wise i.e, i want to compare current month with previous month and last 3rd month. becasue when i use this Dax monthwise I cannot filter it year wise i.e, if i click the year filter say 2018 i am not getting the values for January 2018 to December 2018 instead i am getting the sum of all the years from january to December.
Current month =
CALCULATE (
SUM ( 'Table1'[TotalAmount] ),
FILTER ( ALL ( 'Table1' ), Table1[Date].[month] = MAX ( Table1[Date].[month] ) )
)
Last_month =
CALCULATE (
SUM ( 'Table1'[TotalAmount] ),
FILTER (
ALL ( 'Table1' ),
Table1[Date].[month]
= MAX ( Table1[Date].[month] ) - 1
)
)
Last3Month = CALCULATE (SUM ( 'Table1'[TotalAmount] ),FILTER (ALL ( 'Table1' ),Table1[Date].[month]= MAX ( Table1[Date][month] ) - 2))
Hi @Anonymous ,
You need to add a condition similar to the following:
Current month =
CALCULATE (
SUM ( 'Table1'[TotalAmount] ),
FILTER (
ALL ( 'Table1' ),
Table1[Date].[month] = MAX ( Table1[Date].[month] )
&& Table1[Date].[year] = MAX ( Table1[Date].[year] )
)
)
Last_month =
CALCULATE (
SUM ( 'Table1'[TotalAmount] ),
FILTER (
ALL ( 'Table1' ),
Table1[Date].[month]
= MAX ( Table1[Date].[month] ) - 1
&& Table1[Date].[year] = MAX ( Table1[Date].[year] )
)
)
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.
Hi @sathish_kumar ,
Could you post a screenshot of the model view?
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |