cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Route217 Member
Member

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 Contributor
Super Contributor

Re: Multiple Criteria IF Formula

Try something like this

If(PrimaryYearstoOUtcome =5.0 , 5.0 ,if(PrimaryYearstoOUtcome =5.1,5.0,PrimaryYearstoOUtcome ))
Route217 Member
Member

Re: Multiple Criteria IF Formula

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])))))))))))))))))
amitchandak Super Contributor
Super Contributor

Re: Multiple Criteria IF Formula

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))
Route217 Member
Member

Re: Multiple Criteria IF Formula

brillant thanks you,

Route217 Member
Member

Re: Multiple Criteria IF Formula

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

 

amitchandak Super Contributor
Super Contributor

Re: Multiple Criteria IF Formula

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

Screenshot 2019-09-24 17.30.18.png

Route217 Member
Member

Re: Multiple Criteria IF Formula

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

 

 

Route217 Member
Member

Re: Multiple Criteria IF Formula

HI AmitChandak

 

any luck with the table as discussed

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)