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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Multiple Criteria IF Formula

Hi Experts

 

How would you do the following. 

If PrimaryYearstoOUtcome is 5.0 then 5.0 if PrimaryYearstoOUtcome is 5.1 and we have a 5.0 (in data set as shown) then leave 5.1 as 5.1

 

if(STEMBRANDYEARS[STEMBRAND] = STEMBRANDYEARS[STEMBRAND] && STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 5.0, STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS], IF(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 5.1, 5,

Capture.PNG

 

8 REPLIES 8
amitchandak
Super User
Super User

Try something like this

If(PrimaryYearstoOUtcome =5.0 , 5.0 ,if(PrimaryYearstoOUtcome =5.1,5.0,PrimaryYearstoOUtcome ))
Anonymous
Not applicable

Hi Amitchandak.

 thanks for the excellent feedback, just one slight issues when i have primaryyearstooutcome as 0.0 i am getting a blank in my Year(time) measure in the column... here is the full measure

Years (Time) = 
         if(STEMBRANDYEARS[STEMBRAND] = STEMBRANDYEARS[STEMBRAND] && If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 1.0 , 1.0 , If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 1.1, 1.0, STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] )),
         if(STEMBRANDYEARS[STEMBRAND] = STEMBRANDYEARS[STEMBRAND] && If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 2.0 , 2.0 , If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 2.1, 2.0, STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] )),
         if(STEMBRANDYEARS[STEMBRAND] = STEMBRANDYEARS[STEMBRAND] && If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 3.0 , 3.0 , If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 3.1, 3.0, STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] )),
         if(STEMBRANDYEARS[STEMBRAND] = STEMBRANDYEARS[STEMBRAND] && If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 4.0 , 4.0 , If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 4.1, 4.0, STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] )),   
         if(STEMBRANDYEARS[STEMBRAND] = STEMBRANDYEARS[STEMBRAND] && If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 5.0 , 5.0 , If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 5.1, 5.0, STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] )),
         if(STEMBRANDYEARS[STEMBRAND] = STEMBRANDYEARS[STEMBRAND] && If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 6.0 , 6.0 , If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 6.1, 6.0, STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] )),
         if(STEMBRANDYEARS[STEMBRAND] = STEMBRANDYEARS[STEMBRAND] && If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 7.0 , 7.0 , If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 7.1, 7.0, STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] )),
         if(STEMBRANDYEARS[STEMBRAND] = STEMBRANDYEARS[STEMBRAND] && If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 8.0 , 8.0 , If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 8.1, 8.0, STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] )),
         if(STEMBRANDYEARS[STEMBRAND] = STEMBRANDYEARS[STEMBRAND] && If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 9.0 , 9.0 , If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 9.1, 9.0, STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] )),
         if(STEMBRANDYEARS[STEMBRAND] = STEMBRANDYEARS[STEMBRAND] && If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 10.0 , 10.0 , If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 10.1, 10.0, STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] )),
         if(STEMBRANDYEARS[STEMBRAND] = STEMBRANDYEARS[STEMBRAND] && If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 11.0 , 11.0 , If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 11.1, 11.0, STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] )),
         if(STEMBRANDYEARS[STEMBRAND] = STEMBRANDYEARS[STEMBRAND] && If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 12.0 , 12.0 , If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 12.1, 12.0, STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] )),
         if(STEMBRANDYEARS[STEMBRAND] = STEMBRANDYEARS[STEMBRAND] && If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 13.0 , 13.0 , If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 13.1, 13.0, STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] )),
         if(STEMBRANDYEARS[STEMBRAND] = STEMBRANDYEARS[STEMBRAND] && If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 14.0 , 14.0 , If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 14.1, 14.0, STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] )),
         if(STEMBRANDYEARS[STEMBRAND] = STEMBRANDYEARS[STEMBRAND] && If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 15.0 , 15.0 , If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 15.1, 15.0, STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] )),
         if(STEMBRANDYEARS[STEMBRAND] = STEMBRANDYEARS[STEMBRAND] && If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 16.0 , 16.0 , If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 16.1, 16.0, STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] )),
         if(STEMBRANDYEARS[STEMBRAND] = STEMBRANDYEARS[STEMBRAND] && If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 17.0 , 17.0 , If(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] = 17.1, 17.0, STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] )),
         STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS])))))))))))))))))

If STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] is number or can be compared as number , are you trying to round. Then you can try like this

 

 if(STEMBRANDYEARS[STEMBRAND] = STEMBRANDYEARS[STEMBRAND] 
		 ,If((STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS] >0.0 && STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS]<1.0 ) || isblank(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS]))
		 ,0.0 , round(round(STEMBRANDYEARS[PRIMARYTOOUTCOMEYEARS],0),1))
Anonymous
Not applicable

Hi

 

when i put the measure into a table i am not getting the correct values.... let me share a sample file you'll see the formula is adding up all the values in the primaryyearsto out from 0.0 to 1.0 as opposed to just show the values at data point 0, 1, 2, 3, 4, and so hence my first formula and or you could say we are subtracting the data points as we move from 0.0 year onwards....

ref to tab Duplicate of (Kaplan-Meier)

and table Stembrandyears. 

 

i am trying to get the to the right as produce by R.

https://www.dropbox.com/s/s4wj3qzpblasw66/Kaplan_Miers_v1.2.pbix?dl=0

 

I think you are referring to this. What are the values expected in this table

Screenshot 2019-09-24 17.30.18.png

Anonymous
Not applicable

HI AmitChandak

 

any luck with the table as discussed

Anonymous
Not applicable

Hi Amitchandak

 

I am referring to that table i am expecting the values as shown in the R Table to the left.Capture1.PNG See Below image 

 

 

 

 

 

 

i.e. 0 years is 664 and 1 is 656 and so on....

 

 

Anonymous
Not applicable

brillant thanks you,

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors