cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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.

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

Thanks !

1 ACCEPTED SOLUTION
Community Support

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]))``

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
2 REPLIES 2
Community Support

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]))``

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
Resolver II

Announcements

#### Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

#### Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

#### Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

#### The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors