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.
Hello Power BI Community,
I am having an issue with ParallelPeriod DAX.
I have been using ParallelPeriod function for a while and
this is the first time that the function is not returning my desired result.
Hope you will be able to provide me a solution.
Basically, I want to calculate
1) current year spending
2) last year spending
Here is how I am calculating above.
1)
CY Spend = CALCULATE(SUM('YTD + YTG'[Amount]))
2)
LY Spend = CALCULATE(SUM('YTD + YTG'[Amount]),PARALLELPERIOD('Calendar'[Date].[Date],-12,MONTH))
I have created a relationship between "YTD+YTG" and "Calendar" data.
Both dataset contains date in date format.
Problems:
1) CY spend returns the number I am looking for, while LY spend does not.
2) When I select 2016 period in the timeline visuals, CY spend returns the right value and somehow LY spend returns the same value also. Please see below.
Do you have any idea why this happens and what the solution should be?
Many thanks,
H
Solved! Go to Solution.
ParallelPeriod() will already return full periods. Since you may select at different granularity, I suggest you use SAMEPERIODLASTYEAR or DATEADD.
LY Spend = CALCULATE ( SUM ( 'YTD + YTG'[Amount] ), SAMEPERIODLASTYEAR ( 'Calendar'[Date] ) )
Regards,
ParallelPeriod() will already return full periods. Since you may select at different granularity, I suggest you use SAMEPERIODLASTYEAR or DATEADD.
LY Spend = CALCULATE ( SUM ( 'YTD + YTG'[Amount] ), SAMEPERIODLASTYEAR ( 'Calendar'[Date] ) )
Regards,
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 |
---|---|
114 | |
97 | |
86 | |
70 | |
62 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |