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.
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
Solved! Go to Solution.
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.
Try the following
SumQNty = Sum(MaterialLastDate[Quantity])
Max_Load_Date = max(MaterialLastDate[Creation Date])
DayDiff = DATEDIFF([Max_Load_Date],TODAY(),DAY)-1
Thanks & Regards,
Mohammed Adnan
Lean Power BI: https://www.youtube.com/c/taik18
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
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
99 | |
88 | |
70 | |
62 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |