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
Hikmer
Employee
Employee

PowerBI and OLAP (MDX) Hierarchy will not filter YTD for partial year

I am struggling with PowerBI and showing Current Year to date calcualtions that only refelct yesterdays date and previous days BUT not future days when doing a Year over Year period calcualtion.  At the moment, when reporting from our cube I get the total Previous Year sum instead of a partial PYTD which woudl be a more meaningful calucaltion.  Excel allows me to filter on a calendar day in the hierachy and will show the calcualtion correctly.  However, PowerBI doesn't have this mechanism.  How do people handle partial YTD and PYTD caluclations when using MDX based OLAP cubes?  It's a bit complex so I hope I am explaining this correctly.

1 ACCEPTED SOLUTION
v-sihou-msft
Employee
Employee

@Hikmer

 

To achieve same logic like TOTALYTD() for SAMEPERIODLASTYEAR() in DAX, you can use the PARALLELPERIOD() and OPENINGPERIOD() to apply the data range from first day of previous day to same day last year in your calculation with MDX. Please refer to my sample below:

 

with member [Previous Year YTD] as
sum(
openingperiod(
[Date].[Calendar].[Date],
ancestor(
parallelperiod([Date].[Calendar].[Calendar Year],1, [Date].[Calendar].currentmember)
,[Date].[Calendar].[Calendar Year]
)
)
:
parallelperiod([Date].[Calendar].[Calendar Year],1, [Date].[Calendar].currentmember)
,[Measures].[Internet Sales Amount])
select {[Measures].[Internet Sales Amount],[x]} on 0,
[Date].[Calendar].[Date].members on 1
from
[Adventure Works]

2.PNG

 

3.PNG

 

Regards, 

View solution in original post

1 REPLY 1
v-sihou-msft
Employee
Employee

@Hikmer

 

To achieve same logic like TOTALYTD() for SAMEPERIODLASTYEAR() in DAX, you can use the PARALLELPERIOD() and OPENINGPERIOD() to apply the data range from first day of previous day to same day last year in your calculation with MDX. Please refer to my sample below:

 

with member [Previous Year YTD] as
sum(
openingperiod(
[Date].[Calendar].[Date],
ancestor(
parallelperiod([Date].[Calendar].[Calendar Year],1, [Date].[Calendar].currentmember)
,[Date].[Calendar].[Calendar Year]
)
)
:
parallelperiod([Date].[Calendar].[Calendar Year],1, [Date].[Calendar].currentmember)
,[Measures].[Internet Sales Amount])
select {[Measures].[Internet Sales Amount],[x]} on 0,
[Date].[Calendar].[Date].members on 1
from
[Adventure Works]

2.PNG

 

3.PNG

 

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.