Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis vs MDX Statement

Dear Colleagues,

How do QV Set analysis (please explain with syntax" produce the same result as per below MDX Statement?

([YearMonth].CurrentMember, [Measures].[Months])

+ ([YearMonth].CurrentMember.Lag(1), [Measures].[Months])

+ ([YearMonth].CurrentMember.Lag(2), [Measures].[Months])

+ ([YearMonth].CurrentMember.Lag(3), [Measures].[Months])

+ ([YearMonth].CurrentMember.Lag(4), [Measures].[Months])

+ ([YearMonth].CurrentMember.Lag(5), [Measures].[Months])

+ ([YearMonth].CurrentMember.Lag(6), [Measures].[Months])

+ ([YearMonth].CurrentMember.Lag(7), [Measures].[Months])

+ ([YearMonth].CurrentMember.Lag(8), [Measures].[Months])

+ ([YearMonth].CurrentMember.Lag(9), [Measures].[Months])

+ ([YearMonth].CurrentMember.Lag(10), [Measures].[Months])

+ ([YearMonth].CurrentMember.Lag(11), [Measures].[Months])

NB: "YearMonth" is a dimension based on which the above calc should work out. "Month" is a measure.

Thank you for your help.

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

I think your mdx could also be written as  sum(([YearMonth].CurrentMember.Lag(11), [Measures].[Months])). The sum of Months over the last 12 months.

The set analysis expression would be something like this:

sum({<YearMonth={"<=$(=only(YearMonth)>$(=Only(YearMonth)-12))"}>} Months)

The sum of Month where YearMonth is <= the selected YearMonth and > (YearMonth - 12 months)


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

I think your mdx could also be written as  sum(([YearMonth].CurrentMember.Lag(11), [Measures].[Months])). The sum of Months over the last 12 months.

The set analysis expression would be something like this:

sum({<YearMonth={"<=$(=only(YearMonth)>$(=Only(YearMonth)-12))"}>} Months)

The sum of Month where YearMonth is <= the selected YearMonth and > (YearMonth - 12 months)


talk is cheap, supply exceeds demand
Not applicable
Author

Thank you so much Gysbert.