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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Pieter_parker
Frequent Visitor

DAX calculations, min value out of two columns.

Hello everyone,

 

I'm trying to do some dynamic, row-wise calculations in Power BI. 

1. I would like the measure to take a lower value out of two columns - "Period 1" and "Period 2". 

So basically, I would like to have the following View in my table - "min value" is the desired output. 

Pieter_parker_0-1675767527395.png

I was trying to achieve it with minx function, to calculate everything per row, for example:

- Minx(Table, [Period 1] & [period 2]) - but the returned result is not correct. 

 

Thanks in advance for any help. 

2 ACCEPTED SOLUTIONS
FreemanZ
Super User
Super User

hi @Pieter_parker 

try to add a calculated column like:

Min value = MIN([Period 1], [Period 2])

View solution in original post

smpa01
Super User
Super User

@Pieter_parker  with MINX as calulated column

Column = 
MINX ( { { t1[p1] }, { t1[p2] } }, [Value] )

 

smpa01_0-1675791160327.png

 

with MINX as measure

Measure 2 = MINX ( { { MIN(t1[p1]) }, { MIN(t1[p2]) } }, [Value] )

 

smpa01_1-1675791198261.png

 

with MIN as measure

Measure = min(MIN(t1[p1]),MIN(t1[p2]))

smpa01_2-1675791218121.png

 

 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

5 REPLIES 5
smpa01
Super User
Super User

@Pieter_parker  with MINX as calulated column

Column = 
MINX ( { { t1[p1] }, { t1[p2] } }, [Value] )

 

smpa01_0-1675791160327.png

 

with MINX as measure

Measure 2 = MINX ( { { MIN(t1[p1]) }, { MIN(t1[p2]) } }, [Value] )

 

smpa01_1-1675791198261.png

 

with MIN as measure

Measure = min(MIN(t1[p1]),MIN(t1[p2]))

smpa01_2-1675791218121.png

 

 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Hi @smpa01 -
Thank you for your answer. I have a similar issue and used the measure (measure 2) and got the right values. However I do get wrong row totals. Just like in your screenshot as you have 100 and ideally it should be 400. How can I fix this?

Maybe @FreemanZ could also help here 🙂

@askpbiuser  Sorry, could not reply earlier. You can do any of the following

 

smpa01_0-1701876280081.png

 

smpa01_1-1701876593108.png

 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
FreemanZ
Super User
Super User

hi @Pieter_parker 

try to add a calculated column like:

Min value = MIN([Period 1], [Period 2])

This is what I needed, thank you!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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
Top Kudoed Authors