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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Vosjeee7502
Frequent Visitor

DAX sum with filter

Hi, 

 

I have a dataset which looks like this:

Vosjeee7502_0-1675324719630.png

I basically need a DAX formula which add's the columns "Order gedaan picking" and "Orders openstaand picking" and filters it for a specific time from the column "Meting van". 

 

Hope you can help.

 

1 ACCEPTED SOLUTION

Hi,

In that case, something like this should do:

Measure 30 =
var _cur =
SUM('Table (24)'[Order gedaan picking])+SUM('Table (24)'[Orders openstaand picking]) //current time's value
var _prevTime = CALCULATE(MAX('Table (24)'[Time]),ALL('Table (24)'[Time]),'Table (24)'[Time]<MAX('Table (24)'[Time])) //previous time
var _prev = CALCULATE(SUM('Table (24)'[Order gedaan picking]),ALL('Table (24)'[Time]),'Table (24)'[Time]=_prevTime) + CALCULATE(SUM('Table (24)'[Orders openstaand picking]),ALL('Table (24)'[Time]),'Table (24)'[Time]=_prevTime) //previous time's values
return
_cur-_prev

ValtteriN_0-1675335201424.png

 







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

Proud to be a Super User!




View solution in original post

4 REPLIES 4
Vosjeee7502
Frequent Visitor

@ValtteriN 

 

Thank you for for time and efford and i understand what you mean, however to explain better what i need i'll show you what the outcome of this is. (Purple line)

 

Vosjeee7502_0-1675328864372.png

 

This is incorrect as i would like to see the new orderlines that were generated during the intervals. For 12:30 the correct outcome should be the outcome of he current formule - the outcome of the previous timestamp, in this case 12:00. 

 

Hope you can help.

 

 

 

Hi,

In that case, something like this should do:

Measure 30 =
var _cur =
SUM('Table (24)'[Order gedaan picking])+SUM('Table (24)'[Orders openstaand picking]) //current time's value
var _prevTime = CALCULATE(MAX('Table (24)'[Time]),ALL('Table (24)'[Time]),'Table (24)'[Time]<MAX('Table (24)'[Time])) //previous time
var _prev = CALCULATE(SUM('Table (24)'[Order gedaan picking]),ALL('Table (24)'[Time]),'Table (24)'[Time]=_prevTime) + CALCULATE(SUM('Table (24)'[Orders openstaand picking]),ALL('Table (24)'[Time]),'Table (24)'[Time]=_prevTime) //previous time's values
return
_cur-_prev

ValtteriN_0-1675335201424.png

 







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

Proud to be a Super User!




Hi @ValtteriN 

 

This is absolutely amazing, thank you very much!

ValtteriN
Super User
Super User

Hi,

You can use a simple SUM dax like this:

ValtteriN_0-1675326783794.png



Measure 30 = SUM('Table (24)'[Order gedaan picking])+SUM('Table (24)'[Orders openstaand picking])
ValtteriN_2-1675327009856.png

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/


 

Now place the Time into slicer and you can get the values you want.




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

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors