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
nontmn
Helper I
Helper I

Sum total from MINX calculation mistake

Hello everyone,

I would like to find min value from many column

I make a Measure as

  • M7 =
  • VAR ValueTable =
  • UNION(
  • ROW("valuex",SUM('GR vs GI'[Order no GI])),
  • ROW("valuex",SUM('GR vs GI'[Forecast])),
  • ROW("valuex",SUM('GR vs GI'[Supply]))
  • )
  • RETURN
  • MINX(ValueTable,IF(MIN([valuex])=0,0,[Valuex]))

 

but Total result is mistake for M7 total is should 333
nontmn_2-1641180152760.png

 


and when I change from

  • MINX(ValueTable,IF(MIN([valuex])=0,0,[Valuex]))

to

SUMX('GR vs GI',MINX(ValueTable,IF(MIN([valuex])=0,0,[Valuex])))
the result is
nontmn_1-1641180120244.png

even I change to

  • SUMX(DISTINCT('GR vs GI'[Material]),MINX(ValueTable,IF(MIN([valuex])=0,0,[Valuex])))
or
  • SUMX(VALUE('GR vs GI'[Material]),MINX(ValueTable,IF(MIN([valuex])=0,0,[Valuex])))
Result still same.

I do not use column calculation because I have to compare with another measuer of dynamic sum column .

So how should I do? to correct sum total

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@nontmn here is your measure

 

M7 = 
SUMX ( VALUES ('Table'[M] ),  //material column
VAR __sumO = CALCULATE ( SUM ('Table'[O] ) ) //order no gi columns
VAR __sumF = CALCULATE ( SUM ('Table'[F] ) ) //forecast column
VAR __sumS = CALCULATE ( SUM ('Table'[S] ) ) //supply column
RETURN
 MIN ( MIN ( __sumO, __sumF ), __sumS ) )

 

output

parry2k_0-1641185074893.png

Follow us on LinkedIn and subscribe to our YouTube channel

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

 

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

11 REPLIES 11
parry2k
Super User
Super User

@nontmn and you didn't follow my measure, why you have var outside sumx, there is a reason why these are inside the sumx? Why you wouldn't just copy what I sent? Can you please follow the instruction before making any changes?

 

Follow us on LinkedIn and subscribe to our YouTube channel

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Sorry, I don't know difference between make var inside and outside formula.

 

parry2k
Super User
Super User

@nontmn here is your measure

 

M7 = 
SUMX ( VALUES ('Table'[M] ),  //material column
VAR __sumO = CALCULATE ( SUM ('Table'[O] ) ) //order no gi columns
VAR __sumF = CALCULATE ( SUM ('Table'[F] ) ) //forecast column
VAR __sumS = CALCULATE ( SUM ('Table'[S] ) ) //supply column
RETURN
 MIN ( MIN ( __sumO, __sumF ), __sumS ) )

 

output

parry2k_0-1641185074893.png

Follow us on LinkedIn and subscribe to our YouTube channel

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

 

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k 

output is 2499

nontmn_3-1641186101198.png

 

 

 

@nontmn not when I shared my screenshot, it is giving the correct total. In the screenshot you are sharing, are you showing the sum of each column or no aggregation?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

amitchandak
Super User
Super User

@nontmn , Try like

 

M7 =
VAR ValueTable =
UNION(
summarize(Table, Table[Material],"valuex",SUM('GR vs GI'[Order no GI])),
summarize(Table, Table[Material],,SUM('GR vs GI'[Forecast])),
summarize(Table, Table[Material],SUM('GR vs GI'[Supply]))
)
RETURN
MINX(values(ValueTable[Material]),IF(MIN([valuex])=0,0,[Valuex]))

@amitchandak  Sorry, I can't make last line exist

if I use 

MINX(VALUES(ValueTable),IF(MIN([valuex])=0,0,[Valuex]))
it error. and ValueTable is variable I don't know meaning of ValueTable[Material]

nontmn_0-1641182184124.png

Result

nontmn_1-1641182206197.png

Please tell me more, Thank you

@nontmn , sorry my mistake, try like

MINX(VALUES(ValueTable[Material]),IF(MIN([valuex])=0,0,[Valuex]))

@amitchandak 

ValueTable is variable so it not have ValueTable[Material]

The main table is 'GR vs GI' 

 

nontmn_0-1641183429868.png

 

@nontmn , Let us try a simple measure

 

measure =
var _1 =SUM('GR vs GI'[Order no GI])
var _2 = SUM('GR vs GI'[Forecast])
var _3= SUM('GR vs GI'[Supply])
return
MINX(values(ValueTable[Material]), MIN(MIN(_1,_2),_3))

@amitchandak 

I use material from main table instead

nontmn_4-1641186173719.png

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.