Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
hidenseek9
Post Patron
Post Patron

parallelperiod DAX not working

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.

 

 

2017-12-22 16_31_49-Evian T&E - Power BI Desktop.png

 

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.

 

 

2017-12-22 16_35_50-Evian T&E - Power BI Desktop.png

 

Do you have any idea why this happens and what the solution should be?

 

Many thanks,

 

H

1 ACCEPTED SOLUTION
v-sihou-msft
Employee
Employee

@hidenseek9

 

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,

View solution in original post

1 REPLY 1
v-sihou-msft
Employee
Employee

@hidenseek9

 

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,

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.