Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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 |
Solved! Go to Solution.
Hi @Luis98 ,
Please follow the steps:
1.Create a new table
The model:
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 )
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.
Hi @Luis98 ,
Please follow the steps:
1.Create a new table
The model:
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 )
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.
@Luis98 Not 100% following, what are the expected results from the sample data?
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 |