Forum Discussion
Understanding DAX Filter Context with Nested Measures in Power BI
- 2 years ago
Revising the data model is always a good option. Oftentimes report issues go away when the data model is more robust. You can choose the level of normalization - don't go overboard though, you won't be happy with a 6NF for example. Generally the data model has to follow the business question.
My personal recommendation is not to nest measures. Others will have different opinions. I already have a hard time following the context transitions with a single measure, I don't need the mental gymnastics with nested measures. The "code reuse" aspect is valid, but only if you are absolutely sure that your measure is as optimized as it can be. Otherwise you risk re-using bad measures over and over.
Hello,
Thank you for your response.
I appreciate the insights provided, and I'll certainly delve deeper into the aspects you mentioned. However, I'm considering revising my data model, especially since I didn't segregate the salesperson data into a separate dimension table. I've observed that the ALL function operates seamlessly when applied to slicers on dimension tables. For instance, I have a location table which I frequently use for slicing, and the ALL function in measures seems to function without hitches here. Could this potentially be the crux of the issue?
On a more general note, is it recommended not to nest measures? I was under the impression that nesting measures facilitates code reuse, thereby enhancing efficiency. Were you suggesting this approach solely for the developmental phase to ensure everything runs smoothly, or is this a broader guideline?
Revising the data model is always a good option. Oftentimes report issues go away when the data model is more robust. You can choose the level of normalization - don't go overboard though, you won't be happy with a 6NF for example. Generally the data model has to follow the business question.
My personal recommendation is not to nest measures. Others will have different opinions. I already have a hard time following the context transitions with a single measure, I don't need the mental gymnastics with nested measures. The "code reuse" aspect is valid, but only if you are absolutely sure that your measure is as optimized as it can be. Otherwise you risk re-using bad measures over and over.