Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
hi,
I want to compare two different dates from the same tables
Example:
Below is my table
Meter | date | Cost |
ADB | 12-6-2022 | 23.45 |
ADF | 12-6-2022 | 34.56 |
Storage | 12-6-2022 | 14.56 |
ADB | 12-8-2022 | 12 |
ADF | 12-8-2022 | 23.45 |
Storage | 12-8-2022 | 45.6 |
I want to compare the cost for these two dates such that my output is like this.
Meter | PreviousCost | NewCost |
ADB | 23.45 | 12 |
ADF | 34.56 | 23.45 |
I want to compare dates on the dashboard
Solved! Go to Solution.
Hi @Anonymous ,
Create a new table for user to select the previous date via PreviousDate = VALUES('Table'[date])
Then use this measure to get the values of previous date.
Pbix in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
hi @amitchandak ,
Actually, I want a date filter in the dashboard wherein users can select any 2 days, by which they can compare costs on the selected two days.
Hi @Anonymous ,
Create a new table for user to select the previous date via PreviousDate = VALUES('Table'[date])
Then use this measure to get the values of previous date.
Pbix in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@v-chenwuz-msft , how can I only show the last 3 months dates in the date filter?
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
Those are for creating new measures.
Previous cost measure: =
VAR _latestdate =
MAX ( Data[date] )
VAR _previousdate =
CALCULATE ( MAX ( Data[date] ), Data[date] < _latestdate )
VAR _previouscost =
CALCULATE ( MAX ( Data[Cost] ), Data[date] = _previousdate )
RETURN
IF ( HASONEVALUE ( Data[Meter] ), _previouscost )
New cost measure: =
VAR _latestdate =
MAX ( Data[date] )
VAR _latestcost =
CALCULATE ( MAX ( Data[Cost] ), Data[date] = _latestdate )
RETURN
IF ( HASONEVALUE ( Data[Meter] ), _latestcost )
hi @Jihwan_Kim , will this also work if I select two different dates from a filter via dashboard?
Hi,
Thank you for your feedback.
I cannot know without seeing your data model.
Please share your sample pbix file's link here, and then I can try to have a look into it.
Thanks.
hi @Jihwan_Kim , my table is a single table, with columns meter category, SubscriptionName, date, cost_usd.
@Anonymous , for meausre you can have
Last Day Non Continuous = CALCULATE([sales],filter(ALLSELECTED('Date'),'Date'[Date] =MAXX(FILTER(ALLSELECTED('Date'),'Date'[Date]<max('Date'[Date])),'Date'[Date])))
or
Last Day Non Continuous = CALCULATE([sales],filter(ALLSELECTED('Date'),'Date'[Date] =calculate( max(Sales[Sales Date]), FILTER(ALLSELECTED('Date'),'Date'[Date]<max('Date'[Date])))))
or refer
Day Intelligence - Last day, last non continous day
https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5-5c3243d1f9
Last Day Non Continuous = CALCULATE([sales],filter(ALLSELECTED('Date'),'Date'[Date] =MAXX(FILTER(ALLSELECTED('Date'),'Date'[Date]<max('Date'[Date])),'Date'[Date])))
User | Count |
---|---|
64 | |
59 | |
47 | |
33 | |
32 |
User | Count |
---|---|
84 | |
75 | |
56 | |
50 | |
44 |