cancel
Showing results for
Did you mean:

Nice day

I have a database in which material is continuously added as the days go by, I want to have a table that shows me the material, the last date on which the material is loaded, how many days have passed since then and the count of the total material that has been loaded, for example:

Database:

 No part Creation Date Quantity 1 13/06/2022 3 1 16/06/2022 2 2 06/11/2022 1 2 06/12/2022 3 2 15/06/2022 4 3 06/11/2022 3 3 06/11/2022 1 3 06/12/2022 2

What I would like to show in the table would be the following taking into account that "Today" is 16/06/2022:

 No part Last Creation Date total quantity Counting of days 1 16/06/2022 5 0 2 15/06/2022 8 1 3 06/12/2022 6 4

There are still many things that I need to learn with Dax so I would appreciate your support with this problem

1 ACCEPTED SOLUTION
Community Support

Hi @FalcoTM ,

Try to create measures like so:

``````Measure - Total Quantity =
CALCULATE ( SUM ( 'Table'[Quantity] ), ALLEXCEPT ( 'Table', 'Table'[No part] ) )
``````
``````Measure - Day Counting =
VAR Today_ =
DATE ( 2022, 6, 16 )
RETURN
DATEDIFF ( MAX ( 'Table'[Last Date] ), Today_, DAY )
``````

Best Regards,

Icey

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

3 REPLIES 3
Impactful Individual

Try the following

`SumQNty = Sum(MaterialLastDate[Quantity])Max_Load_Date = max(MaterialLastDate[Creation Date])DayDiff = DATEDIFF([Max_Load_Date],TODAY(),DAY)-1`

Thanks & Regards,

Thanks & Regards,

At the time of entering the formulas it gives me as a result the total sum of all the part numbers as well as the last date obtained, in this way

 No part Creation Date Quantity Last Date Total Quantity Day Counting 1 13/06/2022 3 16/06/2022 19 0 1 16/06/2022 2 16/06/2022 19 0 2 06/11/2022 1 16/06/2022 19 0 2 06/12/2022 3 16/06/2022 19 0 2 15/06/2022 4 16/06/2022 19 0 3 06/11/2022 3 16/06/2022 19 0 3 06/11/2022 1 16/06/2022 19 0 3 06/12/2022 2 16/06/2022 19 0

I would like the formula to get me the calculation for each part number in this way

 No part Creation Date Quantity Last Date Total Quantity Day Counting 1 13/06/2022 3 16/06/2022 5 0 1 16/06/2022 2 16/06/2022 5 0 2 06/11/2022 1 15/06/2022 8 1 2 06/12/2022 3 15/06/2022 8 1 2 15/06/2022 4 15/06/2022 8 1 3 06/11/2022 3 06/12/2022 6 4 3 06/11/2022 1 06/12/2022 6 4 3 06/12/2022 2 06/12/2022 6 4

On the other hand the formula of the counting of days works correctly

Community Support

Hi @FalcoTM ,

Try to create measures like so:

``````Measure - Total Quantity =
CALCULATE ( SUM ( 'Table'[Quantity] ), ALLEXCEPT ( 'Table', 'Table'[No part] ) )
``````
``````Measure - Day Counting =
VAR Today_ =
DATE ( 2022, 6, 16 )
RETURN
DATEDIFF ( MAX ( 'Table'[Last Date] ), Today_, DAY )
``````

Best Regards,

Icey

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

Announcements