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
Velvetine27
Helper I
Helper I

Total value in DAX is not matching with row total

Hi,

 

I wrote up few DAX queries to get total stock quantity. First query is this :

 

SumRunningQuantity =
VAR lowest_date  =  CALCULATE(MIN(TY[ROWNUM2]),GROUPBY(TY, TY[Plant]))
RETURN
  CALCULATE(SUMX(TY,TY[RunningQuantity]),FILTER(TY, TY[ROWNUM2]=lowest_date))
 
Second query is :
TotalRunningQuantity =
SUMX(
    SUMMARIZE(TY, TY[Material],
    "Lowest Row",[SumRunningQuantity])
    ,[SumRunningQuantity])
 
ROWNUM2 is how I put the dates in order because I only want to capture the quantity at the latest date depends on date slicer. 
 
Velvetine27_0-1668582540441.png

 

The correct total should be 28,692,069.52. Appreciate if someone can help me on this.

 

Thanks !

 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Velvetine27 ,

 

Create a new measure by using ISINSCOPE() or ISFILTERED() function.

ISINSCOPE function (DAX) - DAX | Microsoft Learn

ISFILTERED function (DAX) - DAX | Microsoft Learn

Measure = IF(ISINSCOPE([Plant]),[TotalRunningQuantity],SUMX(ALLSELECTED(yourtable),[TotalRunningQuantity]))

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Velvetine27 ,

 

Create a new measure by using ISINSCOPE() or ISFILTERED() function.

ISINSCOPE function (DAX) - DAX | Microsoft Learn

ISFILTERED function (DAX) - DAX | Microsoft Learn

Measure = IF(ISINSCOPE([Plant]),[TotalRunningQuantity],SUMX(ALLSELECTED(yourtable),[TotalRunningQuantity]))

 

Anonymous
Not applicable

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 community update carousel

Fabric Community Update - June 2025

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