Forum Discussion
Need a help regarding latest date by DAX
- 1 year ago
Hi Emranit ,
To display the latest available production date and corresponding data in your Power BI dashboard using DAX, you can create a measure that always returns the maximum (latest) available date from your dataset. You can define it as follows:
Latest_Date = MAX('YourTable'[EndTime])Once you have the latest date, you need another measure that filters and sums the Weight column for that latest available date.
Latest_Production = CALCULATE( SUM('YourTable'[Weight]), 'YourTable'[EndTime] = [Latest_Date] )If you want to ensure that the dashboard always shows data up to the last completed day (yesterday) instead of the maximum available date (which might include future dates), you can modify the Latest_Date measure like this:
Latest_Date = CALCULATE( MAX('YourTable'[EndTime]), 'YourTable'[EndTime] <= TODAY()-1 )With these measures, when a user opens the dashboard, the visuals will dynamically display the production data for the most recent day that has available data. If today is March 1, 2025, the dashboard will show the data for February 28, 2025. As new data is added, the dashboard will automatically update to reflect the latest production date and values.
Best regards,
Hi Emranit ,
To display the latest available production date and corresponding data in your Power BI dashboard using DAX, you can create a measure that always returns the maximum (latest) available date from your dataset. You can define it as follows:
Latest_Date = MAX('YourTable'[EndTime])
Once you have the latest date, you need another measure that filters and sums the Weight column for that latest available date.
Latest_Production =
CALCULATE(
SUM('YourTable'[Weight]),
'YourTable'[EndTime] = [Latest_Date]
)
If you want to ensure that the dashboard always shows data up to the last completed day (yesterday) instead of the maximum available date (which might include future dates), you can modify the Latest_Date measure like this:
Latest_Date =
CALCULATE(
MAX('YourTable'[EndTime]),
'YourTable'[EndTime] <= TODAY()-1
)
With these measures, when a user opens the dashboard, the visuals will dynamically display the production data for the most recent day that has available data. If today is March 1, 2025, the dashboard will show the data for February 28, 2025. As new data is added, the dashboard will automatically update to reflect the latest production date and values.
Best regards,
Hi Dear,
Thanks for nice cooperation. Moreover I want to show latest date and production according to latest date if I didn't select any date. Everday I will open dashboard and it will present last data and production according to last date. Please help me. Here weight means production. please check both link.
https://drive.google.com/file/d/1weGhcEUkdsuKwzYiGO2PUqbZHQsldpvG/view?usp=sharing