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
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
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.