Forum Discussion

darko861's avatar
darko861
Resolver II
4 years ago
Solved

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".

 

 

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

 

Here is a sample file for download:

 

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())

4 Replies