Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block Calculation Group functions in Measures #387

Closed
edhans opened this issue Feb 1, 2022 · 3 comments
Closed

Block Calculation Group functions in Measures #387

edhans opened this issue Feb 1, 2022 · 3 comments
Labels
feature: enhancement Request is a enchacement to existing feature
Milestone

Comments

@edhans
Copy link

edhans commented Feb 1, 2022

I inadvertently used SELECTEDMEASURE() when creating a measure (I was in T/E 3) in addition to the calculation item, which of course did nothing. Only took me 30min to find my problem after all sorts of other troubleshooting steps.

Per SELECTEDMEASURE function (DAX) - DAX | Microsoft Docs though this "Can only be referenced in the expression for a calculation item."

If that is the case, it would be nice if T/E protected us from ourselves and gave us a red squiggly when used anywhere but inside a Calculation Item.

@otykier otykier added issue: bug Confirmed as a bug in TE3 feature: enhancement Request is a enchacement to existing feature and removed issue: bug Confirmed as a bug in TE3 labels Feb 7, 2022
@otykier
Copy link
Collaborator

otykier commented Feb 7, 2022

In general, our DAX parser design philosophy is that we should provide similar error messages as those from Analysis Services/Power BI. Since using SELECTEDMEASURE (or any of the related calc item functions) in a measure is not an error from an Analysis Services point of view (who knows why), we do not show an error message in TE3 either.

However, we can definitely improve the experience in TE3 by removing SELECTEDMEASURE, ISSELECTEDMEASURE, SELECTEDMEASURENAME, etc. from the auto-complete feature, so if you really want to use these functions, you can still do so without TE3 complaining - it just won't suggest them anymore (unless you're writing a calc item expression).

@edhans
Copy link
Author

edhans commented Feb 7, 2022

Anything that will protect us from our dumb coding will help. 😁 Even if you don't throw an error, a tip or some visual indicator that SELECTEDMEASURE() in a measure is meaningless. I agree in general you should adhere to the errors from AS/PBI.

Thanks for the consideration on this. More of a noob issue, or just one of those dumb things coders do sometimes that takes 30min to realize!

@otykier otykier added this to the 3.2.2 milestone Feb 11, 2022
@otykier
Copy link
Collaborator

otykier commented Feb 17, 2022

In 3.2.2 we no longer suggest calc item functions in the auto-complete dropdown, when not editing the expression/format string expression of a calc item.

@otykier otykier closed this as completed Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: enhancement Request is a enchacement to existing feature
Development

No branches or pull requests

2 participants