cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
jhaley Frequent Visitor
Frequent Visitor

PARALLELPERIOD for YTD vs LYTD Calculation - DAX Question

I am asking for help regarding my DAX measure for comparing this year-to-date with last year-to-date. Here are my statements: Calendar Table = CALENDAR (MINX(mytable, mytable[mydate]), NOW()) - Works correctly YTD Measure = TOTALYTD(SUM(mytable[myvalue]), 'DateTable'[Date]) - Works correctly LYTD Measure = CALCULATE([YTD Measure],SAMEPERIODLASTYEAR('DateTable'[Date]) - Does not work how I want it to My LYTD Measure calculates until the end of the month. For Example: YTD = 01/01/2019 thru 01/10/2019 LTYD = 01/01/2018 thru 01/31/2018 But I need it to calculate this: YTD = 01/01/2019 thru 01/10/2019 LTYD = 01/01/2018 thru 01/10/2018 Any help would be appreciated. Thanks
1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: PARALLELPERIOD for YTD vs LYTD Calculation - DAX Question

hi, @jhaley

First, you could try to use another browser like IE, your post will not be messy.

and for your case, SAMEPERIODLASTYEAR and TOTALYTD are Time-intelligence functions. you'd better create a full date table.

You try this way as below:

Step1:

Use CALENDARAUTO Function to create a date table.

Step2:
Add a column for date table to filter date before today.

 

filter = IF(DateTable[Date]<=TODAY(),1,2)

Step3:
Add the field [filter] to report level filter and set filter is 1

5.JPG

Result:

7.JPGBefore6.JPGAfter

 

Best Regards,

Lin

 

 

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 REPLIES 3
jhaley Frequent Visitor
Frequent Visitor

Re: PARALLELPERIOD for YTD vs LYTD Calculation - DAX Question

Sorry about the formatting above. Below is the question formatted correctly: I am asking for help regarding my DAX formula for comparing this year-to-date with last year-to-date. Here are my statements: Calendar Table: = CALENDAR (MINX(mytable, mytable[mydate]), NOW()) - Works Correctly YTD Measure: = TOTALYTD(SUM(mytable[myvalue]), 'DateTable'[Date]) - Works Correctly LYTD Measure: = CALCULATE([YTD Measure],SAMEPERIODLASTYEAR('DateTable'[Date]) - Works Incorrectly My LYTD Measure calculates until the end of the month. For Example: YTD = 01/01/2019 thru 01/10/2019 LTYD = 01/01/2018 thru 01/31/2018 But I need it to calculate this: YTD = 01/01/2019 thru 01/10/2019 LTYD = 01/01/2018 thru 01/10/2018 Any help would be appreciated. Thanks
Community Support Team
Community Support Team

Re: PARALLELPERIOD for YTD vs LYTD Calculation - DAX Question

hi, @jhaley

First, you could try to use another browser like IE, your post will not be messy.

and for your case, SAMEPERIODLASTYEAR and TOTALYTD are Time-intelligence functions. you'd better create a full date table.

You try this way as below:

Step1:

Use CALENDARAUTO Function to create a date table.

Step2:
Add a column for date table to filter date before today.

 

filter = IF(DateTable[Date]<=TODAY(),1,2)

Step3:
Add the field [filter] to report level filter and set filter is 1

5.JPG

Result:

7.JPGBefore6.JPGAfter

 

Best Regards,

Lin

 

 

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
jhaley Frequent Visitor
Frequent Visitor

Re: PARALLELPERIOD for YTD vs LYTD Calculation - DAX Question

Lin,

 

Thanks for the answer and also the help with the formatting. Have a great day.

 

John