Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Complex sum with CALCULATE

My team and I are trying to integrate a solution into our PowerBI model for aggregating a table that is filled every time an event is opened.   So an event is recorded and has a record. Each event...
  • DataNinja777's avatar
    2 years ago

    Hi Anonymous 

    In order to do a flexible duration analysis as your required output, we first need to create a calculated calendar table and set it as a disconnected table with your fact table which contains you scenario fields such as

    • Creation dates
    • Due dates
    • Closure dates

    For this demonstration, I've created a dummy data and set the dummy closure dates to be after the due dates to indicate overdue dates.  (It may not be all overdue in your real data, so this is just for demonstration.)  

    Your data model will look like as shown below:

    Then you can write a duration measure like below for the overdue dates, which totally respects your time dimension.  

    In this way, dax offers a total flexibility with respect to time dimension, and your overdue dates per events are not double counted and will give you correct snapshot of the status at any given point in time in your calendar table. 

    I attach an example pbix file.