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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Row Context and return a single value from Column

I'm struggling with evaluating a row context to determine if the specific row I'm in meets certain criteria. I get the error that basically indicates to me that I'm returning a table of values (I'm assuming as part of the VALUES function) rather than a scalar value, even though in my context, the Table Visual only has a single value that meets the criteria.

In simple terms, what I want is:

 

For given row, if value in column A = X then return a specific value.

 

I found this thread, but not fully wrapping my head around it: https://community.powerbi.com/t5/Desktop/Trying-to-return-a-single-value-if-one-row-from-another-tab...

 

Here is my very simple measure:

 

Measure 2 = 
    IF(
        CONTAINSSTRING(
            VALUES(prog_SiteProgram[CSCat]),
            "TGH:Acute Care:Ambulatory"
        ),         
        [1.acu.a Value],
        BLANK()
    )

 

 

I'm happy with the filtering that is applied on the page, so I don't think I need a CALCULATE function, for the Table that I add the Measure too, I just need it to return in the proper context.

 

Hope this makes sense...

 

Thanks,

-Robert

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

Measure = IF(MAX('Table'[Column]) = X,[1.acu.a Value],BLANK())

 

Assumes 1.acu.a is a measure.

 

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

Measure = IF(MAX('Table'[Column]) = X,[1.acu.a Value],BLANK())

 

Assumes 1.acu.a is a measure.

 

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thanks @Greg_Deckler 

That works, why? I never would think to use MAX on an evaluation of a String.

Think of using MAX and MIN on a string like "last" and "first".

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors