Skip to main content
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Frequent Visitor

Calculation Groups - Problems when using selectedmeasure twice in a calculation item

Hi Everyone,


I've been exploring Calculation groups recently and love how they've let me clean up my measures. I've just run across a strange issue with only one of the calculation items in my calculation group. The calculation Item is called 'KPI Pass %' and conditional formatting is not working on it even though it is working on two other calc items ('Created' and 'KPI Pass' respectively). Here is an example, the cells in each row should be the same colour:


As you can see the conditional formatting is applied to Created and KPI Pass but not to KPI Pass %.


I also get an error when I try to filter other visuals by selecting a value in the KPI Pass % column. The error is Cannot convert [title of matrix from a measure] of type text to type numeric. I am not sure why its trying to convert the title measure of the other matrix to Numeric. I don't get this error if I select a value in the Created or KPI Pass columns. 





KPI Pass % calculation item is based on the other two, DAX:


KPI Pass % =
    CALCULATE ( SELECTEDMEASURE (), DateTypes[Date Types] = "KPI Pass" ),
    CALCULATE ( SELECTEDMEASURE (), DateTypes[Date Types] = "Created" )



I think the problem might be that I use SELECTEDMEASURE twice in the one calculation item. 


Has anyone else come across this issue or have an suggestions to fix it? 


Thank you.

Frequent Visitor

Thanks @amitchandak, I have a measure to assess the current priority and the condiitonal formatting is based on that. For Priority 1, the cell fill shoule be red, for priority 2-4 it should be yellow and then for priority 5-7 it should be green. So the conditional formatting is working for the calculation items 'Created' and 'KPI Pass', but not for the 'KPI Pass %'. 




The only difference I can see between the calc items is that the one the conditional formatting is not working for references SELECTEDMEASURE twice. The calculation itself is working correctly, just not the conditional formatting.

Frequent Visitor

Just to follow on from @amitchandak's point around calculation groups and conditional formatting. There are some good sources online about how to use calculation groups with condtional formatting. I've added a link from well renowed Alberto Ferrari from SQL BI discussing a method which involves field parameters.

Super User
Super User

@JessA , I created a calculation group

Divide1 = divide(CALCULATE(SELECTEDMEASURE(), 'Item'[Brand] = "Brand 1"), CALCULATE(SELECTEDMEASURE(), 'Item'[Brand] = "Brand 2"))


and that is working



For conditional formatting, you should consider measure-based conditional formatting


Please let me know what is exactly you wanted to achieve


Helpful resources

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.


Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.


Fabric certifications survey

Certification feedback opportunity for the community.