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.
Hi,
Have a table as per below -
Need help for calculating yesterday's actual and day before yesterday's actual using DAX.
Solved! Go to Solution.
You can create measure like with date calendar
Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Day))
2 Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-2,Day))
Hi @sayali_deshmukh,
Would you please refer to the following calculated column:
Yesterday's Update = CALCULATE(MAX('Table'[Today's Update]),ALL('Table'),'Table'[Task] = EARLIER('Table'[Task]),'Table'[Date] = EARLIER('Table'[Date])-1)
Day Before Yesterday's Update = CALCULATE(MAX('Table'[Today's Update]),ALL('Table'),'Table'[Task] = EARLIER('Table'[Task]),'Table'[Date] = EARLIER('Table'[Date])-2)
Best Regards,
Dedmon Dai
You can create measure like with date calendar
Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Day))
2 Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-2,Day))
Hi @sayali_deshmukh,
Would you please refer to the following calculated column:
Yesterday's Update = CALCULATE(MAX('Table'[Today's Update]),ALL('Table'),'Table'[Task] = EARLIER('Table'[Task]),'Table'[Date] = EARLIER('Table'[Date])-1)
Day Before Yesterday's Update = CALCULATE(MAX('Table'[Today's Update]),ALL('Table'),'Table'[Task] = EARLIER('Table'[Task]),'Table'[Date] = EARLIER('Table'[Date])-2)
Best Regards,
Dedmon Dai
Hi @v-deddai1-msft
Is there any way to extend this solution to calculate previous dates update continuously so that all updates can be gotten as -
Today's update, yesterday's update, day before yesterday's update and so on...
- without creating the columns
For that prefer to have column like this
maxx(filter(table,table[task]=earlier(table[task]) && table[Date]=earlier(table[Date])-1),[Todays Plan])
Or try the same formula(provided in last update) with Max function and text column
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 |
---|---|
106 | |
93 | |
75 | |
62 | |
50 |
User | Count |
---|---|
147 | |
107 | |
105 | |
87 | |
61 |