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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Niels_T
Post Patron
Post Patron

Using specific date range from different date column from a different table

I have 3 tables: 'Credit Memo + Invoice', 'Calendar', 'Item'

 

I would like to take the column 'Creation Date' ('Item'), and calculate how much 'Quantity' ('Credit Memo + Invoice') of goods that have been sold in the first 3 months since the creation date.

 

Is there any way that I can take the sum of my 'Quantity', filter it on 'Creation Date' + 3 more months after 'Creation Date' and use that specific date range?

 

To make myself even more clearer:

 

Let's say Creation date is 01/10/2021.

 

I want to know through how many goods are being sold between 01/10/2021 and 31/12/2021. 

 

 

The relations between tables are as followed:

 

'Item' [SKU] -> [SKU] 'Credit Memo + Invoice' [Posting Date] <- 'Calendar' [Date]

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Niels_T 

Please try this code.

Qunatity(3 month after creation date) =
CALCULATE (
    SUM ( 'Credit Memo + invoice'[Quantity] ),
    FILTER (
        'Credit Memo + invoice',
        'Credit Memo + invoice'[Posting Date]
            <= EOMONTH ( MAX ( 'Item'[Creation Date] ), 3 )
    )
)

Result is as below.

1.png

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@Niels_T Sample data and expected output would be better. It would be something along the lines of using EOMONTH([CreationDate],3) to calculate the max date. Then you just filter between creation date and that date. Hard to be more specific. 

Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Expected output:

 

Niels_T_1-1635422610811.png

 

Niels_T_0-1635422282905.png

 

I tried the following measure:

Quantity (3 month after creation date) = CALCULATE(SUM('Credit Memo + Invoice'[Quantity (Base)]), EOMONTH('Item'[Creation Date], 3))
 
The thing now is that the value that I receive from EOMONTH('Item'[Creation Date], 3)), should be applied to see how many quantity of items I have in within that date range. 
 
So in short: 
The 'Creation Date' value should act as an indicator from where the date starts.
The 'Posting Date' values within my 'Credit memo + Invoice' need to be contained within that date range.
 
More detailed expected output:
 
Niels_T_0-1635424141513.png

 

 
I hope this is clear.
Anonymous
Not applicable

Hi @Niels_T 

Please try this code.

Qunatity(3 month after creation date) =
CALCULATE (
    SUM ( 'Credit Memo + invoice'[Quantity] ),
    FILTER (
        'Credit Memo + invoice',
        'Credit Memo + invoice'[Posting Date]
            <= EOMONTH ( MAX ( 'Item'[Creation Date] ), 3 )
    )
)

Result is as below.

1.png

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.