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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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 ))
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
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))
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors