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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

sum values of a list of unique values

Hello, I'm having trouble displaying a list of unique values for a second line of code that sum only the Lbs of values in that list, here is my code:

Total LT = 
VAR list = CALCULATE(VALUES('DATA BASE'[OP]),'DATA BASE'[EE] = "LT")
RETURN
CALCULATE(SUM('DATA BASE'[Lbs]),'DATA BASE'[OP]=list)

here's a example of my data base (is a lot more bigger):

exa.PNG

i want the list of the OP's that has some value in EE = LT, for later sum the total Lbs of that OP

 

Thanks

2 ACCEPTED SOLUTIONS

Hi @Anonymous ,

 

Try this measure:

 

Measure = CALCULATE(SUM('Table'[Lbs]); SELECTCOLUMNS(CALCULATETABLE('Table'; 'Table'[EE] = "LT"); "OP"; 'Table'[OP]))
 

If you consider it as a solution, please mark as a solution and kudos.

Ricardo



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

Proud to be a Super User!



View solution in original post

Hi @Anonymous ,

 

Please try the below measure:

 

CALCULATE (
   [Total LBS],
    FILTER (
        SUMMARIZE (
           'Data Base',
            'Data Base'[OP],
            'Data Base'[EE],
            "OP1",
            IF (
                'Data Base'[EE]
                 =
                    "LT",
                    1,
                    0
            )
        ),
       [OP1]
         =
            1
    )
)

 

123.JPG

 

Regards,

Harsh Nathani

 

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

View solution in original post

4 REPLIES 4
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

You can use the below measures.

 

Total LBS = SUM('Data Base'[LBS])
 
 
TOTAL LBS BY OP = CALCULATE(
[Total LBS],
FILTER(ALLEXCEPT('Data Base','Data Base'[OP]),'Data Base'[EE] = "LT"))
 
1.JPG
 
 
Regards,
Harsh Nathani
 
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!!
Anonymous
Not applicable

Thank you @harshnathani , but this is not the result I'm expecting, the measure should sum all the values of the OP only if at least one are in LT, kind of first get rid of the list all the OP's that doesn't have at least one value with EE = LT, after that, sum all Lbs of each OP of this new list whatever the EE is. (i would like to graphic the EE values of every OP in a stacked column chart)

here i did a little example of the steps: 

Captura.PNG

Thank you again for your help.

Hi @Anonymous ,

 

Please try the below measure:

 

CALCULATE (
   [Total LBS],
    FILTER (
        SUMMARIZE (
           'Data Base',
            'Data Base'[OP],
            'Data Base'[EE],
            "OP1",
            IF (
                'Data Base'[EE]
                 =
                    "LT",
                    1,
                    0
            )
        ),
       [OP1]
         =
            1
    )
)

 

123.JPG

 

Regards,

Harsh Nathani

 

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

Hi @Anonymous ,

 

Try this measure:

 

Measure = CALCULATE(SUM('Table'[Lbs]); SELECTCOLUMNS(CALCULATETABLE('Table'; 'Table'[EE] = "LT"); "OP"; 'Table'[OP]))
 

If you consider it as a solution, please mark as a solution and kudos.

Ricardo



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

Proud to be a Super User!



Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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