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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
jignaski18
Helper II
Helper II

Looking to Sum Values returned from a lookup measure

I cannot seem to get the appropriate DAX to get the sum of lookup values in a matrix. The measure is looking up the expectation by the last date. The values pull in correctly but i do not know how to get them to sum in the subtotal. 

 

 

VAR _E = 
CALCULATE(
    MAX('DM Stage Expectations'[Expectationdate]),
        FILTER(ALL('DM Stage Expectations'),
        ('DM Stage Expectations'[Expectationdate]<=max('DM Stage Expectations'[Expectationdate])&&
        'DM Stage Expectations'[Expectationdate]<=enddate&&
        'DM Stage Expectations'[Avg Expectation]<>0&&
        'DM Stage Expectations'[Customer]=cust
        &&'DM Stage Expectations'[Fleet]=crew)))
VAR ZIP = LOOKUPVALUE('DM Stage Expectations'[ZipperExpectation],'DM Stage Expectations'[Expectationdate],_E)
VAR STK = LOOKUPVALUE('DM Stage Expectations'[StackExpectation],'DM Stage Expectations'[Expectationdate],_E)
VAR EXPT = IF(CALCULATE(COUNTA('Eng_Metrics_RPT'[Zipper]),'Eng_Metrics_RPT'[Zipper] IN { TRUE })>0,ZIP,STK)
RETURN
 SWITCH(SELECTEDVALUE(Categories[ID]),
    8,EXPT
)

 

jignaski18_1-1605636404364.png

 

3 REPLIES 3
v-stephen-msft
Community Support
Community Support

Hi @jignaski18 ,

 

Please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

 

Generally speaking, HASONEVALUE function is often used to solve the subtotal problem. Please kindly refer to: 

 

https://community.powerbi.com/t5/Desktop/Subtotal-not-working-properly/m-p/644407#M308803

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you Stephen. I cannot share the file due to the nature of the connections, but here is a screenshot of what i am trying to accomplish in the subtotal. The attached excel file has a table of how the data is stored (actually stored in a sharepoint list). Example data

 

Id like to mention that the values to the left of the "/" are a calculated value and the values to the right are a lookup from the sharepoint list. 

 

 

Edit 3.JPG

Hi @jignaski18 ,

 

I can't download your Eample data.  Please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

 

How did the data in the red box come from? Is it in text format?

 

For now, it is suggested that you try to create the following measure to display values.

 

IF(HASONEVALUE('Table'[District]),A,B)

 

In A, put the field in the red box in your picture, and in B, write the measure of how you add the above values.

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors
Top Kudoed Authors