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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
tp365
Regular Visitor

SELECTEDVALUE() with Calculation Groups sometimes returning blanks(?) when used in a table

Hey All,

I am trying to build a report for water quality reporting. 

 

Context:

I have several parameters that are evaluated using a measure that is just ParameterName = AVERAGE(Parameter[ParameterName]).

These measures serve as the column headers in a table.  The rows are formed using a calculation group calculating that measure over different weeks in that month, the maximum weekly average, if the parameter is ph of Dissolved Oxygen, report the Min or Max value recorded, etc.

 

Problem:

Certain Calculation Items are not returning values when using SELECTEDVALUE().  This is a problem because i am attempting to conditionally format based on the Calculation Item.

 

Here a simple version of the table i am using to troubleshoot:

tp365_4-1737559209127.png

The measure for the SelectedValue column is 

SelectedValue = SELECTEDVALUE(Group1[Calculation])
 
I dont think the blanks are actual blanks, because when i write a measure saying If its blank, display something else, that doesn't work either.  Neither does a blank string.
 
Focusing on MAX Weekly Avg - the calculation item is:
tp365_5-1737559438657.png

 

This returns nothing? blank? empty?  not sure...

 

However this calc item returns the name.

tp365_6-1737559613404.png

 

Am i missing something?

 

 

5 REPLIES 5
Nina123
New Member

I am experiencing this issue as well. Even when I try SELECTEDVALUE('Calculation group'[Ordinal]), it does not give the ordinal.

What I did to solve it was: create a new table which summarizes the calculation group table. Create a relationship between the calculation group table and the new table. And use the new table columns in measurs for conditional formatting.

Hi @Nina123 , 
I would be glad to see your solution in detail.

Sahir_Maharaj
Super User
Super User

Hello @tp365,

 

Can you please try this approach:

MAX Weekly Avg =
IF(
    OR(
        CONTAINSSTRING(SELECTEDMEASURENAME(), "Eff pH"),
        CONTAINSSTRING(SELECTEDMEASURENAME(), "Eff DO")
    ),
    BLANK(),
    MAXX(
        ADDCOLUMNS(
            VALUES('Calendar'[DMR Week]),
            "WeeklyValue", CALCULATE(SELECTEDMEASURE())
        ),
        [WeeklyValue]
    )
)

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Thanks for the reply @Sahir_Maharaj.

 

The suggested Calculation Item does give the appropriate maximum weekly average, however the SelectedValue is still blank.

 

tp365_0-1737579957571.png

Oddly enough, the ordinal will populate, but when used in a conditional format, it doesn't register at all, even under the "else" condition.

 

Here is the Measure i am applying as conditional formatting using field values for the column represented here:

tp365_1-1737580056381.png

It does not recognize if i use SelectedValues(DMR[Calculation]) or SelectedValues(DMR[Ordinal]) for [MAX Weekly Avg] even though the ordinal actually populates.

 

@tp365 were you ever able to resolve this issue? I think this behavior is currently impeding my attempts to implement conditional formating for my calculation groups as well.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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