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
pablo_paiva
Frequent Visitor

How to use Summarizecolumn in this case

Hi,

I've been working with Power BI for the last weeks and I tried to find a solution for this simple issue.

 

Look at the table sample below, I have the first 5 columns are data consolidated from different sources (data services analysis server & sharepoint files) so data is quite large and takes a lot of time to load in my pc. I want to find the most efficient solutionto add the columns (in red) to reflect the qty of parts in shortage or excess at highest organization level (Level 1) by PN.

 

Originally, I had the table without the sublevel, so it was very easy to create 2 columns and 2 measures to display the result in a  dashboard, but when I added the sublevel I couldn't find the solution

 

Level 1SublevelPartQty RequiredQty AvailableQty Required @ Level 1Qty Available @ Level 1Qty Shortage @ Level 1Qty Excess @ Level 1Qty Shortage % @ Level 1Qty in Excess % @ Level 1
AXPN1202+3+4 = 90+4+1 = 59-5=40(9-5)/5=80% 
AYPN1342+3+4 = 90+4+1 = 59-5=40(9-5)/5=80% 
AZPN1412+3+4 = 90+4+1 = 59-5=40(9-5)/5=80% 
BUPN1131+2+3 = 63+3+3=909-6=3 (9-6)/6=50%
BVPN1231+2+3 = 63+3+3=909-6=3 (9-6)/6=50%
BWPN1331+2+3 = 63+3+3=909-6=3 (9-6)/6=50%


I thought using:

 

- Group by in Editor Query by Level 1 & Part and later try to join the tables. But as it takes too much time to create the tables, I think that I'm unnecessary increasing the size of my report.

 

- Use a DAX expression to add a column, but I get an incorrect result or it doesn't work:

 

1. Qty Required @ Level 1 = SUMX(summarize('Table',[Level 1], [Part]),'Qty Required')

(Incorrect result, huge number)

 

2. Qty Required @ Level 1 = SUMMARIZECOLUMNS('Table',[Level 1], [Part],"QTY REQ Lev1",'Table'[Qty Req])

(The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.)

 

Any recommendations? 

Writing the DAX expression for the columns is more efficient than creating a table in Editor Query?

 

Thanks in advance,

Pablo

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

@pablo_paiva,

 

You may use DAX below.

Column =
SUMX (
    FILTER (
        'Table',
        'Table'[Level 1] = EARLIER ( 'Table'[Level 1] )
            && 'Table'[Part] = EARLIER ( 'Table'[Part] )
    ),
    'Table'[Qty Required]
)
Community Support Team _ Sam Zha
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

1 REPLY 1
v-chuncz-msft
Community Support
Community Support

@pablo_paiva,

 

You may use DAX below.

Column =
SUMX (
    FILTER (
        'Table',
        'Table'[Level 1] = EARLIER ( 'Table'[Level 1] )
            && 'Table'[Part] = EARLIER ( 'Table'[Part] )
    ),
    'Table'[Qty Required]
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.