cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
wayston Frequent Visitor
Frequent Visitor

Show value from text column

Hi,

 

I have a simple table (Table1) and I'm trying to make a measure (Measure1) which prints text from two columns (Name1, Name2) depending the value in "Value" -column.

 

If "Value"=0, print Name2.

 

How do I do this measure?

 

Table1

Name1Name2ValueMeasure1 (If Value = 0, print Name2)
SmithBeaner0Beaner
SimonsonBee1Simonson
AdamsBeck0Beck

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Adamtall Regular Visitor
Regular Visitor

Re: Show value from text column

 
Hi, cant you make a column instead? 
 
Column = IF('Table'[Value] = 0;'Table'[Name2];'Table'[Name1])
 
/Adam

View solution in original post

3 REPLIES 3
Adamtall Regular Visitor
Regular Visitor

Re: Show value from text column

 
Hi, cant you make a column instead? 
 
Column = IF('Table'[Value] = 0;'Table'[Name2];'Table'[Name1])
 
/Adam

View solution in original post

EricHulshof Member
Member

Re: Show value from text column

To only give the solution would be easy so im also trying to explain how IF statements work in PBI Measures. 

This is your solution.

Measure = IF(SELECTEDVALUE(Table1[Value])=0;SELECTEDVALUE(Table1[Name2]);SELECTEDVALUE(Table1[Name1]))

 
To simplify an if statement its basically this:
IF(Logic;Iflogicistrue;iflogicisfalse)
But a measure allways needs some form ¨Group" unlike columns. Where in a calculated column you can refer to another column by just refering in a measure you need MAX() MIN() or in this case i used SELECTEDVALUE().

Then i selected the column with the value and checked if it was 0. If it was i would use name2. If it wasent i would use name1.
If you would like to expand this statement it would look something like this:

Measure = IF(Selectedvalue(Value)=0;Name2;IF(Selectedvalue(value)=1;name1;Othervalue))

I hope this makes sense! Goodluck

If this post helped please consider marking it as a solution.

wayston Frequent Visitor
Frequent Visitor

Re: Show value from text column

Great! The column was the reason! Thanks!

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors