Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Suppose in this example I have a calculation group for cumulative sum
I would like to have a measure that can detect what the active calculation item is.
I notice that the Calculation Group can be accessed like a table in DAX. I create a measure to concatenate the measure names:
Detect CalcGroup = CONCATENATEX('CalcGroup Cumulative Sum', CONVERT( [Cumulative Sum Group], STRING), ",")
The card measure shows that it is working when both are not filtered out.
However, when only one is filtered, an error is shown:
I do not know why this is happening. As you can see in the DAX measure, I have purposely converted the [Cumulative Sum Group] column into a String just to see if this fixes the problem, but it does not. Also, it works fine for multiple values, but not for a single value. I was hoping to use this mechanism to detect which calculation group is active, is there any possibility of this working?
Solved! Go to Solution.
I have realized my error. The calculation item's calculation affects the measure that I am creating and it comes into play when a single calculation item is selected. A workaround is for each calculation item, if the SELECTEDMEASURENAME() equals to the measure name, return SELECTEDMEASURE().
I have realized my error. The calculation item's calculation affects the measure that I am creating and it comes into play when a single calculation item is selected. A workaround is for each calculation item, if the SELECTEDMEASURENAME() equals to the measure name, return SELECTEDMEASURE().
Hi @BZ_AF ,
Based on my research, it seems that the issue you are facing is due to the fact that the CONCATENATEX function requires at least two arguments to work properly. When only one value is filtered, the function is unable to concatenate the values and throws an error.
One possible solution to this issue is to use the SELECTEDVALUE function instead of the CONVERT function. The SELECTEDVALUE function returns the value of the specified column when there is only one distinct value in the filter context, and returns a blank when there are multiple distinct values.
Detect CalcGroup =
IF (
HASONEVALUE ( 'CalcGroup Cumulative Sum'[Cumulative Sum Group] ),
SELECTEDVALUE ( 'CalcGroup Cumulative Sum'[Cumulative Sum Group] ),
BLANK ()
)
This measure checks if there is only one distinct value in the filter context. If there is, it returns the value of the ‘Cumulative Sum Group’ column. If there are multiple distinct values, it returns a blank.
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Rongtie
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Unfortunately this solution doesn't seem to work.
I copied and pasted your measure and put it in a card. It shows (Blank) if >1 is selected. But if 1 is selected the same error occurs.
How do I attach a .pbix file? Trying to attach it here gives an error:
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
21 | |
15 | |
15 | |
11 | |
7 |
User | Count |
---|---|
25 | |
24 | |
12 | |
12 | |
11 |