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
Anonymous
Not applicable

Acumulate fortnight

Hi, I´m new here and have a doubt about DAX.

 

Yesterday I was dealing with the purchase attachment and wanted to create a table with the following information:

Knowing that the supplier ship on the 15th and 1st of each month, I wanted a table that would accumulate those purchases on the days they ship, to get a table showing how much quantity I will receive on each day.

I tried to do a DAX measure with MTD and with this I was able to get the 15th day, but I am not able to get the 1st day.

 

Any suggestions?

 

Thanks.

 

Date Purchases
2022/01/05 706
2022/01/10 1312
2022/01/22 806
2022/01/27 210
2022/02/02 1037
2022/02/10 1808
2022/02/17 1311
2022/02/25 1793
2022/03/03 1500
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Please follow the steps:

1.Create a new table

vbinbinyumsft_0-1658106668030.png

The model:

vbinbinyumsft_1-1658106685754.png

 

2.Create a table visual, and create a measure

Shipment =
VAR cur_date =
    MAX ( 'Table 4'[Dates] )
VAR pre_date =
    CALCULATE (
        MAX ( 'Table 4'[Dates] ),
        FILTER ( ALL ( 'Table 4' ), 'Table 4'[Dates] < cur_date )
    )
VAR temp_table =
    CALCULATETABLE (
        'Table 3',
        'Table 3'[Date] <= cur_date
            && 'Table 3'[Date] >= pre_date
    )
RETURN
    CALCULATE ( [sum_purchase], temp_table )

vbinbinyumsft_2-1658106758658.png

 


If I misunderstand your demands, please feel free to let me know.


Best regards,
Community Support Team_ Binbin Yu
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
Anonymous
Not applicable

Hi @Anonymous ,

 

Please follow the steps:

1.Create a new table

vbinbinyumsft_0-1658106668030.png

The model:

vbinbinyumsft_1-1658106685754.png

 

2.Create a table visual, and create a measure

Shipment =
VAR cur_date =
    MAX ( 'Table 4'[Dates] )
VAR pre_date =
    CALCULATE (
        MAX ( 'Table 4'[Dates] ),
        FILTER ( ALL ( 'Table 4' ), 'Table 4'[Dates] < cur_date )
    )
VAR temp_table =
    CALCULATETABLE (
        'Table 3',
        'Table 3'[Date] <= cur_date
            && 'Table 3'[Date] >= pre_date
    )
RETURN
    CALCULATE ( [sum_purchase], temp_table )

vbinbinyumsft_2-1658106758658.png

 


If I misunderstand your demands, please feel free to let me know.


Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Community Champion
Community Champion

@Anonymous Not 100% following, what are the expected results from the sample data?



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...
Anonymous
Not applicable

Sorry @Greg_Deckler , I just see that the table is not okay.

 

My table´s purchase has the following structure:

 

Date

 

Purchase

2022/01/05 706
2022/01/10 1,312
2022/01/22 806
2022/01/27 210
2022/02/02 1,037
2022/02/10 1,808
2022/02/17 1,311
2022/02/25 1,793
2022/03/03 1,500

 

And I want to get the next table: 

Dates

 

Shipment

2022/01/15 2,018
2022/02/01 1,016
2022/02/15 2,845
2022/03/01 3,104
2022/03/15 1,500

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.