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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Slicing
Frequent Visitor

Annual Daily Sales by Detail - but replace (smooth) some dates

I have daily snapshots of detailed sales data. Over the 365 days, there are some days which the data is poor/empty. Our solution is to replace certain with other days. For example, if May 1 2019 is a bad date, pull rows for May 2 2019 and show them for the row for May 1 2019.

 

  • Output table columns: Location, AsOfDate, Dollars

In summary: pull all sales history ... but if a record existed in the Replacement table, pull data for the Good Date instead of data for the Bad Date.  This is a SSAS model, so if this can be a measure which performs this "smoothing" for any detail view - that would be ideal. 

 

_goodDate =
LOOKUPVALUE (
    DEV_Replacement_Dates[GoodDate],
    DEV_Replacement_Dates[Location], MIN ( ORDER_HISTORY[Location] ),
    DEV_Replacement_Dates[BadDate], MIN ( ORDER_HISTORY[AS_OF_DATE] )
)

 

_smoothedDollars =
IF (
    ISBLANK ( [_goodDate] ),
    SUM ( ORDER_HISTORY[Dollars] ),
    SUMX (
        FILTER ( ORDER_HISTORY, ORDER_HISTORY[AS_OF_DATE] = [_goodDate] ),
        ORDER_HISTORY[AS_OF_DATE] = [_goodDate]
    )
)

 

 

1 REPLY 1
mahoneypat
Microsoft Employee
Microsoft Employee

I would suggest you filter out your "bad" dates in the query (or at least flag them as such there), and then write DAX that looks for the given date, and returns the +/-1 day in the case it is blank (or flagged as "bad").  Would that work?

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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