Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi folks, i am playing around the DAX and came across this issue. So the calculated column should return the case number of last day of the same county. It works fine for the first few rows but the stops changing after. But if I returned the date, it works prefect. Why would this happened? Please advised. Thank you!
Solved! Go to Solution.
please try this
Column =
VAR _date=MAXX(FILTER('Table','Table'[countryFIPS]=EARLIER('Table'[countryFIPS])&&'Table'[State]=EARLIER('Table'[State])&&'Table'[date]<EARLIER('Table'[date])),'Table'[date])
return MAXX(FILTER('Table','Table'[countryFIPS]=EARLIER('Table'[countryFIPS])&&'Table'[State]=EARLIER('Table'[State])&&'Table'[date]=_date),'Table'[cases])Proud to be a Super User!
please try this
Column =
VAR _date=MAXX(FILTER('Table','Table'[countryFIPS]=EARLIER('Table'[countryFIPS])&&'Table'[State]=EARLIER('Table'[State])&&'Table'[date]<EARLIER('Table'[date])),'Table'[date])
return MAXX(FILTER('Table','Table'[countryFIPS]=EARLIER('Table'[countryFIPS])&&'Table'[State]=EARLIER('Table'[State])&&'Table'[date]=_date),'Table'[cases])Proud to be a Super User!
Hi @ronlolololo ,
It is because your date column is ranking ascending,so using your expression can get the result you need,but if your date column is disordering,then you will get a wrong return,such as your case number.
The best solution is to create an index column.
I made a simple sample,pls see attached.
@ronlolololo - Difficult to say. Please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 33 | |
| 33 | |
| 29 |
| User | Count |
|---|---|
| 132 | |
| 90 | |
| 78 | |
| 66 | |
| 65 |