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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Vogels
Frequent Visitor

Get a text output from a row context measure

Hi PBI-forum users,

 

I'm trying to get a text output in a measure based on an IF-statement. 

I know it's possible to just add an column with an if-statement like if(table[column] < 10; "Category 1"; "Category 2").

However i'm using what-if parameters in my report and they are only useable with measures and not columns. 

I know I can use sumx(table, if(table[column] < 10; 1; 0).

 

However, I need the row context in order to give me a text output like:

sumx(table, if(table[column] < 10; "Category 1"; "Category 2") (this measure obviously does not work with sumx, but I hope you understand what I'm trying to do...

 

I can't think of any function on how to achieve this, does anyone on here?

 

Thanks in Advance!

2 ACCEPTED SOLUTIONS
AlB
Super User
Super User

@Vogels 

I'm not sure I understand but this  

 

New Col = if(table1[column] < 10, "Category 1", "Category 2")

 

 you can implement with a measure like

 

Measure = if (DISTINCT(table1[column]), < 10, "Category 1", "Category 2"))

 

or

 

Measure = if (SUM(table1[column]), < 10, "Category 1", "Category 2"))

 

and then the exact equivalent:

 

New Col  = [Measure]

 

context transition will help you behind the scenes

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

 

 

View solution in original post

V-pazhen-msft
Community Support
Community Support

@Vogels 
I am not quite sure, but to get the what you are expected with the

column = if(table[column] < 10; "Category 1"; "Category 2"), 

 

you can create the following measure:

Measure = if(SUM([Column])<10, "Category 1", "Category 2")
 
Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
V-pazhen-msft
Community Support
Community Support

@Vogels 
I am not quite sure, but to get the what you are expected with the

column = if(table[column] < 10; "Category 1"; "Category 2"), 

 

you can create the following measure:

Measure = if(SUM([Column])<10, "Category 1", "Category 2")
 
Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.
AlB
Super User
Super User

@Vogels 

I'm not sure I understand but this  

 

New Col = if(table1[column] < 10, "Category 1", "Category 2")

 

 you can implement with a measure like

 

Measure = if (DISTINCT(table1[column]), < 10, "Category 1", "Category 2"))

 

or

 

Measure = if (SUM(table1[column]), < 10, "Category 1", "Category 2"))

 

and then the exact equivalent:

 

New Col  = [Measure]

 

context transition will help you behind the scenes

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

 

 

AlB
Super User
Super User

Hi @Vogels 

Ok, but what operation are you trying to do with that text, if it's not the addition that SUMX provides and that is not valid in this case? Maybe CONCATENATEX( )? If not, what?

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

Vogels
Frequent Visitor

I need to get an text-output in the row context, so each row is categorized. However this needs to work with my whatif parameters, because my visuals need to adjust on this. 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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