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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ShwetaPandey512
New Member

To find a min of 3 numbers in Dax in Direct query mode

Min(Min(D1,D2),D3) want to convert this into DAX that can be used in Direct Query mode

@PowerBI 

2 ACCEPTED SOLUTIONS

@ShwetaPandey512 , You are right it will not work in Direct query here is an old alternate solution if it helps

 

https://community.fabric.microsoft.com/t5/Desktop/Replacement-for-FIRSTNONBLANK-in-calculated-column...




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

Anonymous
Not applicable

Hi bhanu_gautam ,thanks for the quick reply, I'll add more.

Hi @ShwetaPandey512 ,

Instead of creating calculated column, try creating measure with the following dax.

Measure = MIN(MIN(MAX([D1]),MAX([D2])),MAX([D3]))

Or use a nested if loop to create calculated columns, after my testing the min function seems to have limitations.

Column = 
VAR _d1 = [D1]
VAR _d2 = [D2]
VAR _d3 = [D3]
RETURN 
IF( _d1 < _d2,
  IF(_d1 < _d3,_d1,_d3),
  IF(_d2 < _d3,_d2,_d3)
)

 

Best Regards

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi bhanu_gautam ,thanks for the quick reply, I'll add more.

Hi @ShwetaPandey512 ,

Instead of creating calculated column, try creating measure with the following dax.

Measure = MIN(MIN(MAX([D1]),MAX([D2])),MAX([D3]))

Or use a nested if loop to create calculated columns, after my testing the min function seems to have limitations.

Column = 
VAR _d1 = [D1]
VAR _d2 = [D2]
VAR _d3 = [D3]
RETURN 
IF( _d1 < _d2,
  IF(_d1 < _d3,_d1,_d3),
  IF(_d2 < _d3,_d2,_d3)
)

 

Best Regards

 

bhanu_gautam
Super User
Super User

@ShwetaPandey512 , Try using

 

DAX
MINX(
{
(D1),
(D2),
(D3)
},
[Value]
)

 

In this DAX expression, a table is constructed with the values of D1, D2, and D3, and then MINX is used to find the minimum value from this table. This approach ensures that the calculation is compatible with Direct Query mode.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Thanks @bhanu_gautam  for the response but  getting below error
MINX is not allowed as part of calculated column DAX expression on Direct Query mode 

@ShwetaPandey512 , You are right it will not work in Direct query here is an old alternate solution if it helps

 

https://community.fabric.microsoft.com/t5/Desktop/Replacement-for-FIRSTNONBLANK-in-calculated-column...




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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