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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Kudoed Authors