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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
JeffPtak
Frequent Visitor

Getting error from time intelligence calculation group

Hi everyone. I am working on a Power BI report where I added a Calculation Group for 10 various time intelligence calculations (MTD, YTD, QTD, etc...). The first of which is simply:

Current = SELECTEDMEASURE()

To test my time intelligence calculations, I added a Matrix visual to my report. 

In the Rows I added Month from my Date dimension.
Time Calculations from my Calc Group to Columns
A simple measure "Total Sales" defined as Total Sales = SUM(Fact_Sales[Sales Amount]).

Shortly after I drop those items into the Matrix, I get an error:

Error fetching data for this visual
Cannot convert value 'Current' of type Text to type Number

 

I don't see where I can specify a data type for this calculation group item. What am I missing here?

3 ACCEPTED SOLUTIONS
rajendraongole1
Super User
Super User

Hi @JeffPtak  - you can use the ISSELECTEDMEASURE function to apply the calculation group only to numerical measures:

 

Current =
IF(
ISSELECTEDMEASURE([Total Sales]),
SELECTEDMEASURE(),
BLANK()
)

 

it  limits the scope of the calculation group item to the intended measures (e.g., Total Sales). hope this helps





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

Anonymous
Not applicable

 

Hi All,
Firstly  rajendraongole1 thank you for your solution!
And @JeffPtak ,

It looks like you're not familiar with this function, no matter, I'll give you a detailed answer:
SELECTEDMEASURE() is a special function in Power BI that returns the currently selected metric (e.g. total sales, profit, etc.). When you are working with calculation groups, SELECTEDMEASURE() will help you find the metric you selected in the report and then perform a calculation on it.
For example, if you select the measure Total Sales in the Values area of the Matrix, SELECTEDMEASURE() automatically returns the value of Total Sales.
If you select another measure, such as Total Profit, then SELECTEDMEASURE() will return the value of Total Profit.
The error you are getting is usually because SELECTEDMEASURE() is not correctly recognizing the metric you have selected, or the types of metrics you are using in the Matrix table do not match.
Here are some suggestions I hope you find useful:
1. Make sure you have selected the correct metric (e.g. Total Sales) in the “Values” area of the Matrix table. If the metric is not selected correctly, SELECTEDMEASURE() will not return a numeric value.
Ensure that the metric in the Calculation group is of numeric type: if you are using SELECTEDMEASURE(), it should return a numeric value (such as Sales Amount), not text. If it returns text, Power BI reports an error.
2. Test SELECTEDMEASURE(): You can create a simple test formula to confirm that SELECTEDMEASURE() is working properly, like this:

Test Measure = SELECTEDMEASURE()

If it returns text or blanks, you may need to adjust the context or metric definition.
3.If there is a problem with SELECTEDMEASURE(), you can check its value with IF():

Test Measure = IF(ISBLANK(SELECTEDMEASURE()), 0, SELECTEDMEASURE())

If the metric is not checked, it returns 0.

In general SELECTEDMEASURE() calculates based on the metrics you have selected in the report, and it will return an error if the metrics are not selected correctly, or if there is a problem with the context setting. Make sure that your calculation groups and metrics are set up correctly, and that the value returned is of numeric type.
SELECTEDMEASURE function (DAX) - DAX | Microsoft Learn

Hope it helps!

Best regards,
Community Support Team_ Tom Shen

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

JeffPtak
Frequent Visitor

Not sure what was going on. I recreated the Calc Group and now everything is working just fine.

View solution in original post

4 REPLIES 4
JeffPtak
Frequent Visitor

Not sure what was going on. I recreated the Calc Group and now everything is working just fine.

JeffPtak
Frequent Visitor

That didn't work. Got the same error.

I am new to calculation groups. Can you explain to me how the Calc Group knows what the "Selected Measure" is?

Anonymous
Not applicable

 

Hi All,
Firstly  rajendraongole1 thank you for your solution!
And @JeffPtak ,

It looks like you're not familiar with this function, no matter, I'll give you a detailed answer:
SELECTEDMEASURE() is a special function in Power BI that returns the currently selected metric (e.g. total sales, profit, etc.). When you are working with calculation groups, SELECTEDMEASURE() will help you find the metric you selected in the report and then perform a calculation on it.
For example, if you select the measure Total Sales in the Values area of the Matrix, SELECTEDMEASURE() automatically returns the value of Total Sales.
If you select another measure, such as Total Profit, then SELECTEDMEASURE() will return the value of Total Profit.
The error you are getting is usually because SELECTEDMEASURE() is not correctly recognizing the metric you have selected, or the types of metrics you are using in the Matrix table do not match.
Here are some suggestions I hope you find useful:
1. Make sure you have selected the correct metric (e.g. Total Sales) in the “Values” area of the Matrix table. If the metric is not selected correctly, SELECTEDMEASURE() will not return a numeric value.
Ensure that the metric in the Calculation group is of numeric type: if you are using SELECTEDMEASURE(), it should return a numeric value (such as Sales Amount), not text. If it returns text, Power BI reports an error.
2. Test SELECTEDMEASURE(): You can create a simple test formula to confirm that SELECTEDMEASURE() is working properly, like this:

Test Measure = SELECTEDMEASURE()

If it returns text or blanks, you may need to adjust the context or metric definition.
3.If there is a problem with SELECTEDMEASURE(), you can check its value with IF():

Test Measure = IF(ISBLANK(SELECTEDMEASURE()), 0, SELECTEDMEASURE())

If the metric is not checked, it returns 0.

In general SELECTEDMEASURE() calculates based on the metrics you have selected in the report, and it will return an error if the metrics are not selected correctly, or if there is a problem with the context setting. Make sure that your calculation groups and metrics are set up correctly, and that the value returned is of numeric type.
SELECTEDMEASURE function (DAX) - DAX | Microsoft Learn

Hope it helps!

Best regards,
Community Support Team_ Tom Shen

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

rajendraongole1
Super User
Super User

Hi @JeffPtak  - you can use the ISSELECTEDMEASURE function to apply the calculation group only to numerical measures:

 

Current =
IF(
ISSELECTEDMEASURE([Total Sales]),
SELECTEDMEASURE(),
BLANK()
)

 

it  limits the scope of the calculation group item to the intended measures (e.g., Total Sales). hope this helps





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.