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
thebigwhite
Helper II
Helper II

Aggregation Problem with Power BI

Hello I have the following issue: 

 

I have two tables. 

One with Quantity and another with values

 

thebigwhite_0-1666267141803.png

Basically the user needs a dynamic result: 

The want to have the minimum quantity for each Item  by Group. 

This must be multiplied by the Value of the relative Table. 

 

The want to be free to select on which group evaluate the analysis. 

 

Can you help me? 

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @thebigwhite ,

 

Check the formulas:

itemview = MINX(TableA,TableA[Qty])*CALCULATE(SUM(TableB[amount]),FILTER(TableB,TableB[Value]=SELECTEDVALUE(TableA[Item])))

groupview = CALCULATE(MIN(TableA[Qty]),ALLEXCEPT(TableA,TableA[Item],TableA[Group]))*CALCULATE(SUM(TableB[amount]),FILTER(TableB,TableB[Value]=SELECTEDVALUE(TableA[Item])))

vjaywmsft_0-1666940166841.png

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

7 REPLIES 7
v-jayw-msft
Community Support
Community Support

Hi @thebigwhite ,

 

Check the formulas:

itemview = MINX(TableA,TableA[Qty])*CALCULATE(SUM(TableB[amount]),FILTER(TableB,TableB[Value]=SELECTEDVALUE(TableA[Item])))

groupview = CALCULATE(MIN(TableA[Qty]),ALLEXCEPT(TableA,TableA[Item],TableA[Group]))*CALCULATE(SUM(TableB[amount]),FILTER(TableB,TableB[Value]=SELECTEDVALUE(TableA[Item])))

vjaywmsft_0-1666940166841.png

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
thebigwhite
Helper II
Helper II

I am sorry I haven't mentioned that the two tables are connected Item<->Value

is the relationship 1 to many?

 

The same formula works for the Group View as well

mangaus1111_1-1666274274155.png

 

mangaus1111
Solution Sage
Solution Sage

Hi @thebigwhite ,

 

MINX(TableA;TableA[Qty]*RELATED(TableB[Value]))  is a measure (not a calculated column). It works only if you create a 1 (Table B) to many (Table A) relationship.

 

Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Resolver!!

mangaus1111
Solution Sage
Solution Sage

Hi @thebigwhite ,

 

for Item View you can use

 

MINX(TableA;TableA[Qty]*RELATED(TableB[Value]))

amitchandak
Super User
Super User

@thebigwhite , Create a new column in Table1

 

Maxx(filter(Table2, Table2[item] = table1[item]), Table2[Value]) *Table[Qty]

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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