cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jct999
Helper III
Helper III

How to create a measure that give a specific value from a table, based on a condition

Hello

 

I have a table in my model that contains parameters (i.e : (key, value)):
The table has 2 columns :

- ParamName : Name of the parameter (string)

- ParamValue : Value of the parameter (may be string, integer, date)

 

How can I create measure that returns the ParamValue based on a given ParamName ?

I tried that, but it does not work :

Measure =FIRSTNONBLANK(PARAM[ParamValue ];PARAM[ParamName ]="TheNameOfTheParameter")

 

Thanks

1 ACCEPTED SOLUTION
dedelman_clng
Community Champion
Community Champion

Hi @jct999  - 

 

You can use LOOKUPVALUE for this:

 

Measure = 
var __PN = SELECTEDVALUE(PARAM[ParamName])
RETURN
LOOKUPVALUE ( PARAM[ParamValue], PARAM[ParanName], __PN )

 

Hope this helps

David

View solution in original post

1 REPLY 1
dedelman_clng
Community Champion
Community Champion

Hi @jct999  - 

 

You can use LOOKUPVALUE for this:

 

Measure = 
var __PN = SELECTEDVALUE(PARAM[ParamName])
RETURN
LOOKUPVALUE ( PARAM[ParamValue], PARAM[ParanName], __PN )

 

Hope this helps

David

Helpful resources

Announcements
Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Power BI Dev Camp Session 22 768x460.jpg

Check it out!

Mark your calendars and join us on Thursday, May 26 at 11a PDT for a great session with Ted Pattison!