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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
darko861
Resolver II
Resolver II

IF statement in a Matrix

Hi all,

I have the following Matrix visual as shown down below. Is it possible to tweak the "W/O Reason" measure to get a text line called "Various reasons" in the row "SR_Service_RecID" (11882) in cases where the underlying row Time_RecID (176315, 176316, 176318) has various W/O Reasons?

 

My current measure W/O Reason looks like this: 

W/O Reason= IF(HASONEVALUE(v_EIS_Combined_Employee_Company_Time[No_bill_reason_3]),VALUES(v_EIS_Combined_Employee_Company_Time[No_bill_reason_3]),BLANK())
 
I have already tried swapping BLANK() for a string "Various reasons", but it doesn't work properly, because then all blank rows would get the same text line. In this case, I only want SR_Service_RecID 11882 to get the text "Various reasons".

 

darko861_1-1648196560869.png

 

The data is imported from a Sql database, the yellow highlighted field is the basis for the measure.

darko861_2-1648197577119.png

 

Here is a sample file for download:

 

https://www.dropbox.com/s/m02gi8921l97o5z/Sample_Data.pbix?dl=0

 

1 ACCEPTED SOLUTION

W/O Reason = 
var r = countrows(values(xxx[No_bill_reason_3]))
return switch(true(),r=1,max(xxx[No_bill_reason_3]),r>1,"Various reasons",BLANK())

View solution in original post

4 REPLIES 4
lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. Avoid posting screenshots of your source data if possible.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

@lbendlin Hi, here is a sample data file. I appreciate it if you can help me.

 

https://www.dropbox.com/s/m02gi8921l97o5z/Sample_Data.pbix?dl=0

 

 

W/O Reason = 
var r = countrows(values(xxx[No_bill_reason_3]))
return switch(true(),r=1,max(xxx[No_bill_reason_3]),r>1,"Various reasons",BLANK())

This is exactly what I needed, thanks a lot!

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.