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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
MDL88
Regular Visitor

many sum of mins

Hello All,

I am hoping someone can assist. I am a new user and have been stumped with this problem.

I have a table with a list of products and then an inventory table. The column "Product Key" in the inventory table relates all similar products together. There is also a "Supply chain level" column which relates the materials together at a processing step.

I need to be able to SUM up the Supply Column by like products in the product key, then add the MIN summed number per Supply chain Level together.

I have included a sample table below and an attached illistration of how I visualize getting the answer. 

If there is a better table structure, measure, or calculated column that someone can recommend I would be grateful. At the end of the day, I am looking to have a the single number in the green box that can be filtered with a few slicers to remove Material, Supply, & Report date.
Thank you all for taking the time to read this. I truly appreciate any support on this. 

-Matt

MaterialPlntSupplyReport DateKeyProduct Key (sum)Supply Chain Level (min)
A10002711-12-20211000_A11
A10002611-15-20211000_A11
A20002511-12-20212000_A22
A20002411-15-20212000_A22
B2000100011-12-20212000_B32
B2000100011-15-20212000_B32
C2000-111-12-20212000_C44
C2000-111-15-20212000_C44
D2000-111-12-20212000_D55
D2000-111-15-20212000_D55
E2000-111-12-20212000_E66
E2000-111-15-20212000_E66
O600011811-12-20216000_O88
R6000-111-12-20216000_R88
O600011811-15-20216000_O88
R6000-111-15-20216000_R88
M6000-111-12-20216000_M108
M6000-111-15-20216000_M108
S60002811-12-20216000_S118
P6000100011-12-20216000_P118
V600019011-12-20216000_V118
S60002711-15-20216000_S118
P6000100011-15-20216000_P118
V600019311-15-20216000_V118
Q6000-1011-12-20216000_Q128
N6000100011-12-20216000_N128
F3000-411-12-20213000_F128
Q6000-1511-15-20216000_Q128
N6000100011-15-20216000_N128
F3000-511-15-20213000_F128

2021-11-17 17_47_38-Book1 - Excel.jpg

 

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

Hi, @MDL88 ;

You also could try it.

SUM = 
CALCULATE (
    SUM ( 'Table'[Supply] ),
  FILTER(ALL('Table'),[Product Key (sum)]=MAX('Table'[Product Key (sum)])))
Min = 
var _a=SUMMARIZE('Table',[Supply Chain Level (min)],"1", MINX(ALLEXCEPT('Table','Table'[Supply Chain Level (min)]),[SUM]))
return SUMX(_a,[1])

The final output is shown below:

vyalanwumsft_0-1637646193162.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @MDL88 ;

You also could try it.

SUM = 
CALCULATE (
    SUM ( 'Table'[Supply] ),
  FILTER(ALL('Table'),[Product Key (sum)]=MAX('Table'[Product Key (sum)])))
Min = 
var _a=SUMMARIZE('Table',[Supply Chain Level (min)],"1", MINX(ALLEXCEPT('Table','Table'[Supply Chain Level (min)]),[SUM]))
return SUMX(_a,[1])

The final output is shown below:

vyalanwumsft_0-1637646193162.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

MFelix
Super User
Super User

Hi @MDL88 ,

 

Try creating the following 3 measures:

 

SUM Supply chain = 
CALCULATE (
    SUM ( 'Table'[Supply] ),
    FILTER (
        ALL ( 'Table' ),
        'Table'[Product Key (sum)] = MAX ( 'Table'[Product Key (sum)] )
    )
)

Min sum supply chain product key = 
VAR Temp_table =
    FILTER (
        SUMMARIZE (
            ALLSELECTED ( 'Table' ),
            'Table'[Product Key (sum)],
            "SUMSP", [SUM Supply chain]
        ),
        'Table'[Product Key (sum)] <= MAX ( 'Table'[Product Key (sum)] )
    )
RETURN
    MINX ( Temp_table, [SUMSP] )




Min Supply chain SUM =
VAR Temp_table =
    GROUPBY (
        SUMMARIZE ( 'Table', 'Table'[Key], "MinSP", [Min sum supply chain product key] ),
        [MinSP]
    )
RETURN
    IF (
        HASONEVALUE ( 'Table'[Key] ),
        [Min sum supply chain product key],
        SUMX ( Temp_table, [MinSP] )
    )

 

The second measure is just for calculation purposes so don't use it on your table, use the first and the third.

MFelix_0-1637579359560.png

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.