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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Peta_g
Helper I
Helper I

DAX for open/active list of tasks or invoices

Hi group

I'm wanting to list open tasks/orders (or could be used for unpaid invoices).

I have read alberto ferrari's https://www.sqlbi.com/articles/analyzing-events-with-a-duration-in-dax/ but that's counting & averaging & I can't seem to get what I want - just a list of data (task id)

when a task is in progress between a selected date range.

This is the code I have so far adapted from Alberto's

Capture.JPG
& my model:

Capture.JPG

Thanks for any assistance - i don't know how to attach my dummy data PIBX

1 REPLY 1
TomMartens
Super User
Super User

Hey @Peta_g 

 

besides the whitepaper you mentioned already I also urgently recommend you to read this great blogpost by Jason Thomas: http://sqljason.com/2012/11/classifying-and-solving-events-in.html

 

Looking at your DAX statement and your relationship screenshots, there are two things.

 

  1. Referencing the date column
    As you define a measure  it's necessary to wrap an aggregation function around the column reference like so MAX('<tablename>'[<columnname>]) This is due to the filter context a measure will be evaluated in.
  2. Date relationship
    A lot of solutions that are circling around the event-in-progress challenge leverage a date table that is not relateted to the the fact table, I assume this is your table "work".
    Tasks/Invoices will be filtered immediately by the selected dates in accordance with the relationship. From my experience the same MAXDate can not be used for the start and end date, this just works, if a task will be closed at the same date.

If you need more help, please consider to create a sample pbix file that reflects your data model, upload the file to onedrive or dropbox, and share the link.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.