DAX equavalent for MDX

Hi -- I have a time hierarchy in SSAS OLAP. Year - Quarter - Month.

When a user selects a Month if I want to navigate to the Last Month in Previous Year, I can write refer as CurrentMember.Parent.Parent.PrevMember.LastChild.LastChild

How do I do the same thing in DAX?

Thanks

Krish

July 29th, 2015 11:40am

Well, you can get a good idea of date manipulation here:

http://www.powerpivot-info.com/post/143-q-how-can-i-calculate-difference-between-two-dates-in-dax-seconds-minutes-hours-days-and-months

And here is a reference to DAX time intelligence functions:

https://msdn.microsoft.com/en-us/library/ee634763.aspx

I'm not exactly sure what you are trying to accomplish, are you trying to display some measure or ?

Free Windows Admin Tool Kit Click here and download it now
July 29th, 2015 12:23pm

Hi Seth -- Say I have Sales Measures. I am actually looking for calculating difference between Current Selected Month Sales and Sales in Last Year's last month.
July 29th, 2015 12:36pm

In DAX you could use DATEADD (see Seths link). There you would go x numbers of intervalls back/forward. x being the number of the selected month:

Where DimDate is a date/calendar table with a contiguous series of dates - prerequisite for using DAX's time intelligence functions. Linked to your data table ("Tabelle1") via Date

DATEADD (DimDate[Date];-MONTH(MAX(Tabelle1[Date]));MONTH)

Free Windows Admin Tool Kit Click here and download it now
July 29th, 2015 2:55pm

Hi Krish,

According to your description, you need to implement the calculation in DAX as CurrentMember.Parent.Parent.PrevMember.LastChild.LastChild in MDX, right?

In Multidimensional you have specific aggregation types, like LastChild and LastNonEmpty. In PowerPivot and Tabular you use DAX, which is flexible enough to implement any calculation. In your scenario, you can use PreviousYear together with last date function to achieve your requirement. Please refer to the useful links below to see the details.
http://www.sqlbi.com/articles/semi-additive-measures-in-dax/
https://support.office.com/en-in/article/PREVIOUSYEAR-Function-DAX-8f0edd1d-be6d-488c-9990-55775d0c8534

Regards,

July 30th, 2015 2:35am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics