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
rrr3521
Frequent Visitor

Calculations based on two date fields

Ok. Here's my problem. I have a table with two date fields (DateOrdered and DateInvoiced)

The DateInvoiced value typically a few weeks after the DateOrdered value (see sample below)

I'm trying to do some calculations based on both date fields. A simple example would be the SUM of sales (Price column) for last year. Using the example below, I would get $160 using DateOrdered and $40 using DateInvoiced

 

Ideally, we would like our user to pick that from a date slicer (as in the picture) and pick "Last 1 Year" for example. Then the result would be on a simple table with both sum of sales based on DateOrdered and also based on DateInvoiced (see picture)

 

Question.PNG

 

The immediate problem is that the slicer can only be linked to one of the dates on my table. 

 

I have only been able to use a LIMITED number of options (YTD, MTD, etc) using the approach described in this video: https://www.youtube.com/watch?v=I0UV7bGvu_U

 

Notice in the video how the timeframes are defined in a table called SelectMeasures. So we would need to add in that table a limited number of options (YTD, MTD, QTD, etc). Whereas by a having a single date slicer we can pick pretty much any possible timeframe (i.e. last 7 weeks, last 3 days, last 8 months, this month, next day, etc, etc, etc)

 

Any possible way this can be accomplished? I already told my manager this might not be possible, but maybe there is a clever way to do it. Any help would be truly appreciated.

 

Thanks!

 

2 REPLIES 2
Greg_Deckler
Super User
Super User

Check out my Quick Measures here which might help you with your situation:

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thank you Greg! I will go ahead and see how I can use what it is demonstrated in the articles.

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.