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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
nandvroe
Frequent Visitor

Assistance with Dax Formula

I am in need of some assistance with a Dax formula.  I have tried several variations of the formula below:

 

TotalPending = CALCULATE(SUM(SalesOrderLines[Net amount]), (SalesOrderLines[Line status])<>"Invoiced", ALLEXCEPT(SalesOrderLines,SalesOrderLines[Customer]),FILTER( ALL(SalesOrderLines[Created date]),[Created date]<=[LastD]))) 

 

but am unable to get the entire formula to work.  

 

 

 

1.  I am attempting to sum (SalesOrderLines[Net amount] 

2.  for only (SalesOrderLines[Line Status] <> "Invoiced"  

 

and do the following

3.  Ignore filter by the Date Slicer, but instead filter dates <= [LastD] 

4.  Ignore filter by the Customer Slicer 

 

LastD=LastDate(DateTbl[Date])

 

I can get parts 1-3 above to work with the following formula:

 

TotalPending = CALCULATE(SUM(SalesOrderLines[Net amount]),SalesOrderLines[Line status]<>"Invoiced",FILTER( ALL(SalesOrderLines[Created date]),[Created date]<=[LastD]))

 

I'm struggling to wrap my head around "All" and "AllExcept".  I'm stating the obvious when I say I've very new to DAX, Smiley LOL so any help is greatly appreciated.

 

Thank you

1 ACCEPTED SOLUTION

@Zubair_Muhammad

 

Thanks to your help, I was able to get the Dax syntax that I needed.  The formula that seems to be working is:

 

TotalPending2 =
CALCULATE (
SUM ( SalesOrderLines[Net amount] ),
SalesOrderLines[Line status] <> "Invoiced",
ALLEXCEPT (SalesOrderLines,SalesOrderLines[Customer]), FILTER ( ALL ( SalesOrderLines[Created date] ), [Created date] <= [LastD] )
)

 

Again, I'm finding the All and the AllExcept a little confusing.  Thank you again for your help.

 

 

View solution in original post

3 REPLIES 3
Zubair_Muhammad
Community Champion
Community Champion

@nandvroe

 

Give this a try...Just removing filters from Customer column using ALL

 

TotalPending =
CALCULATE (
    SUM ( SalesOrderLines[Net amount] ),
    SalesOrderLines[Line status] <> "Invoiced",
    FILTER ( ALL ( SalesOrderLines[Created date] ), [Created date] <= [LastD] ),
    ALL ( SalesOrderLines[Customer] )
)

Regards
Zubair

Please try my custom visuals

Zubair,

Thank you.  However the formula still continues to respond to the Customer filter (slicer).  

 

 

@Zubair_Muhammad

 

Thanks to your help, I was able to get the Dax syntax that I needed.  The formula that seems to be working is:

 

TotalPending2 =
CALCULATE (
SUM ( SalesOrderLines[Net amount] ),
SalesOrderLines[Line status] <> "Invoiced",
ALLEXCEPT (SalesOrderLines,SalesOrderLines[Customer]), FILTER ( ALL ( SalesOrderLines[Created date] ), [Created date] <= [LastD] )
)

 

Again, I'm finding the All and the AllExcept a little confusing.  Thank you again for your help.

 

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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