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
alasharimm
Regular Visitor

Power BI - Retrieve Latest Work Package Data with Export Date Slicer (Bulk + Daily Changes)

I’m working with Power BI to analyze work package (WP) data over time. My dataset includes an initial bulk export of all WPs followed by daily exports that only include WPs with changes. Each record is tied to an Export_Date. I need to be able to:

  • View the most recent record for every unique WP up to and including the selected Export_Date using a slicer.
  • Ensure that all WPs are shown, even if they haven’t changed on or after the selected Export_Date.
  • The WP data should reflect the state of the WP at any given point in time, based on the historical Export_Date.

Key Requirements:

  1. The slicer allows me to select any Export_Date, and the data should show the latest available record for each unique WP up to and including that date.
  2. If a WP hasn’t changed recently, I still need to see its last known state from previous export dates.

Data Structure:

  • Initial bulk export: Contains all WPs as of a certain point in time.
  • Daily exports: Only include WPs that have been modified on that day.

What I Have Tried:

  1. I’ve created a variable to capture the maximum export date for each WP up to and including the selected Export_Date from the slicer.
  2. I’ve used SUMMARIZE to group by WPNO_I and calculate the latest export date for each WP.
  3. I’ve used TREATAS, LOOKUPVALUE, and FILTER to filter the fact table and retrieve the most recent record per WP.

Current DAX Formula ive used:

 

KPI - Total WP =
VAR SelectedExportDate =
    MAX ( WP_Fact_Qry[Export_Date] ) -- Get the selected export date from the slicer
VAR LatestExportDatePerWP =
    SUMMARIZE (
        WP_Fact_Qry,
        WP_Fact_Qry[WPNO_I],
        -- Group by work package
        "Latest Export Date",
            CALCULATE (
                MAX ( WP_Fact_Qry[Export_Date] ),
                WP_Fact_Qry[Export_Date] >= SelectedExportDate -- Get the latest export date <= the selected date
            )
    )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( WP_Fact_Qry[WPNO_I] ),
        -- Count distinct work packages
        TREATAS (
            LatestExportDatePerWP,
            WP_Fact_Qry[WPNO_I],
            WP_Fact_Qry[Export_Date]
        )
    )

 

Issue:

The formula works but ignores WPs that haven’t changed on the selected export date. If a WP wasn’t updated on or after the selected date, it’s not being shown, but I need to see the most recent record for every WP at any point in time based on the selected export date.

Additional Information:

  • Bulk export of WPs was done initially, followed by daily exports of only the changed WPs.
  • I want to be able to see the state of any WP at any point in time, based on the historical export data.

Any help or suggestions on how to retrieve the latest record for each WP, even if they haven’t changed, based on a Export_Date slicer would be greatly appreciated!

a brief summary of the Table in question:
contains a list of work packages (WPs), with each row representing the state of a work package at a given export date. The WPNO_I field, while representing the work package, is not unique, as a work package may have multiple rows if changes occur in future exports. The table tracks key fields related to the status, dates, and KPIs of each work package at the time of export.



 

1 ACCEPTED SOLUTION

well no solution has been provided however my workaround is to use the same formula and use a date filter with slider type "Below"

View solution in original post

3 REPLIES 3
v-yajiewan-msft
Community Support
Community Support

Hi @alasharimm,

 

I'm checking how the things are going on about this issue. Whether the answer helps you?

 

If there is any problem, please feel free to let us know.

 

well no solution has been provided however my workaround is to use the same formula and use a date filter with slider type "Below"

gmsamborn
Super User
Super User

Hi  @alasharimm 

 

In the 12th line, I think your >= should be <= or the comment doesn't make sense.

 

WP_Fact_Qry[Export_Date] >= SelectedExportDate -- Get the latest export date <= the selected date

 

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.