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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
aiyosap
Helper II
Helper II

While loop in a column..is this possible

Hi all,

I am wondering if there is a way to perform a looping in my current situation describe below.

I would like the power BI to insert a text called "Biggest" when it looping through and compare the value in each cell in the "Total Onhold Working Days" based on column "Case ID" (see below)

 

There is a loop and if statement to be embedded in this custom column (Determinant) and I am not sure how to do it.

The table on the left has been accending and descending order like the picture show.

1.JPG

 

Hope you can shed a light. Thank You

1 ACCEPTED SOLUTION

Hi @aiyosap 

 

Please try the following for calculated column:

 

Calculated Column = 
Var CurrentID = [Case ID]
Var MaxValue = MAXX(FILTER(ALL('Table'),[Case ID]=CurrentID),[Total Onhold Working Days])
RETURN 
IF('Table'[Total Onhold Working Days]=MaxValue,"biggest",BLANK())

 

 

And for measure, it would be like this as follows, copied by my previous answer:

 

Measure = 
Var CurrentID = MAX([Case ID])
Var MaxValue = MAXX(FILTER(ALL('Table'),[Case ID]=CurrentID),[Total Onhold Working Days])
RETURN
IF(MAX('Table'[Total Onhold Working Days])=MaxValue,"biggest",BLANK())

 



Please mark my post as the solution if this answers your question!
Appreciate your Kudos !!

View solution in original post

3 REPLIES 3
johnyip
Solution Sage
Solution Sage

Hi @aiyosap , try to create a measure:

 

Measure = 
Var CurrentID = MAX([Case ID])
Var MaxValue = MAXX(FILTER(ALL('Table'),[Case ID]=CurrentID),[Total Onhold Working Days])
RETURN
IF(MAX('Table'[Total Onhold Working Days])=MaxValue,"biggest",BLANK())

 



Please mark my post as the solution if this answers your question!
Appreciate your Kudos !!

Hi John,

 

Sorry but would that measure possible in a calculated column?

 

Regards,

Yong

Hi @aiyosap 

 

Please try the following for calculated column:

 

Calculated Column = 
Var CurrentID = [Case ID]
Var MaxValue = MAXX(FILTER(ALL('Table'),[Case ID]=CurrentID),[Total Onhold Working Days])
RETURN 
IF('Table'[Total Onhold Working Days]=MaxValue,"biggest",BLANK())

 

 

And for measure, it would be like this as follows, copied by my previous answer:

 

Measure = 
Var CurrentID = MAX([Case ID])
Var MaxValue = MAXX(FILTER(ALL('Table'),[Case ID]=CurrentID),[Total Onhold Working Days])
RETURN
IF(MAX('Table'[Total Onhold Working Days])=MaxValue,"biggest",BLANK())

 



Please mark my post as the solution if this answers your question!
Appreciate your Kudos !!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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