Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

View all the Fabric Data Days sessions on demand. View schedule

Reply
Anonymous
Not applicable

Daily total between two dates

Hi everyone - Interesting use case has come up.

As a user, I want to select two dates, so that I can see the Daily Total Spend for each date on the same row. This is not the running total for the date, it is the true spend for the two days.

 

I am OK with getting a daily cost for a single day but how would I get the daily cost for two separate days and get the data in the same table? I would really like this solution to involve a date picker so the user can select any day they want.

 

The category is subscriptions in Azure.

 

What other information do you need?

1 ACCEPTED SOLUTION

hi  @Anonymous 

For your case, you could use a matrix visual to get it.

Just drag date field into columns of matrix visual, and for slicer, if you just want to choose two date, you'd better use list for this slicer.

5.JPG

 

and if you want use range of a slicer(Between), you could create a measure as below to get it:

Measure = 
var ascdaterank =RANKX(ALLSELECTED('Table'[Date]),CALCULATE(MAX('Table'[Date])),,ASC)
var descdaterank =RANKX(ALLSELECTED('Table'[Date]),CALCULATE(MAX('Table'[Date])),,DESC)
return
IF(ascdaterank=1||descdaterank=1,CALCULATE(SUM('Table'[Cost])))

 

Result:

6.JPG

 

and here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

@Anonymous , if take a date and put into a slicer, you have range option with a down symbol.

Same way if you put date in table or row of a matrix or on the axis of visual you can see day-wise data.

 

The information you have provided is not making the problem clear to me. Can you please explain with an example.

Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks - The range of a slicer is a little off; we need to compare the values associated with two dates without worrying about what falls in between them.

 

hi  @Anonymous 

For your case, you could use a matrix visual to get it.

Just drag date field into columns of matrix visual, and for slicer, if you just want to choose two date, you'd better use list for this slicer.

5.JPG

 

and if you want use range of a slicer(Between), you could create a measure as below to get it:

Measure = 
var ascdaterank =RANKX(ALLSELECTED('Table'[Date]),CALCULATE(MAX('Table'[Date])),,ASC)
var descdaterank =RANKX(ALLSELECTED('Table'[Date]),CALCULATE(MAX('Table'[Date])),,DESC)
return
IF(ascdaterank=1||descdaterank=1,CALCULATE(SUM('Table'[Cost])))

 

Result:

6.JPG

 

and here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi Lin - That is a legitimate solution, thank you so much. Works exactly as expected. It did not occur to me to use the date as a dropdown; sometimes it takes a fresh set of eyes. Stay safe and healthy. 

Greg_Deckler
Community Champion
Community Champion

Not really enough information to go on, 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.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thank you for the advice; I have tried to match your request and please let me know additional requests.

1. Power BI Usage_Details Table

Subscription_NameCostYearMonthDay
Name_12.246436512020May1
Name_232.38104132020May1
Name_320.07923052020May1
Name_44.841154592020May1

 

2. Desired Result

SubscriptionNameCostYearMonthDayCost_2Year_2Month_2Day_2
Name_12.2464365112020May12.246436512020May17
Name_232.237710442020May132.38104132020May17
Name_320.090017962020May120.07923052020May17
Name_44.8811551112020May14.841154592020May17

 

3. I would like the flexibility of selecting any two dates. I do not want, for example, to select the first date and then a relative second date (i.e., 1 week before, 1 week after).

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors