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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
JLEmlet
Regular Visitor

Running Totals Take Forever Need Some Direction

Howdy -

I have what I think is a rather simple problem.  I have a table with about 800K rows in it.  There's a date column, an hours column, a customer column and a sales column.  I'd like for the report to allow the users to select a date and a customer and have a table show the total sales by hour as well as cume sales by hour.  I have a working solution, but it literally takes about 60 seconds for the table to populate when I change dates or customers.  So I must be doing something wrong.  My running total formula is 

Sales RT =
CALCULATE(
    SUM('GA'[Sales]),
    FILTER(
        ALLSELECTED('GA'[CalendarDateTime]),
        ISONORAFTER('GA'[CalendarDateTime], MAX('GA'[CalendarDateTime]), DESC)
    )
)
 
If you can help me solve this issue, my next challenge is showing the total sales for the prior year for the same client/day selected.

 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@JLEmlet fundamentally you are missing a calendar dimension in your model, any time intelligence-based calculations should be done using Date/Calendar dimension in the model and it is a best practice. Add a calendar dimension, you can follow my blog post to add one and in your measure, replace all the references to the calendar dimension and the column from this dimension and it should be lightning fast.

 

Create a basic Date table in your data model for Time Intelligence calculations | PeryTUS IT Solutio...

 

You can always find a workaround but I would hate to advise those and highly recommend adding a Calendar dimension in your model.

 

Follow us on LinkedIn

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

4 REPLIES 4
parry2k
Super User
Super User

Just curious why we are not advising to add the calendar dimension rather fixing the measure. Am I missing something?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

smpa01
Super User
Super User

@JLEmlet  does this improve?

Sales RT =
VAR _tbl =
    ALLSELECTED ( 'GA'[CalendarDateTime] )
VAR _max =
    MAX ( 'GA'[CalendarDateTime] )
RETURN
    CALCULATE (
        SUM ( 'GA'[Sales] ),
        FILTER ( _tbl, ISONORAFTER ( 'Table'[Date], _max, DESC ) )
    )
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
parry2k
Super User
Super User

@JLEmlet fundamentally you are missing a calendar dimension in your model, any time intelligence-based calculations should be done using Date/Calendar dimension in the model and it is a best practice. Add a calendar dimension, you can follow my blog post to add one and in your measure, replace all the references to the calendar dimension and the column from this dimension and it should be lightning fast.

 

Create a basic Date table in your data model for Time Intelligence calculations | PeryTUS IT Solutio...

 

You can always find a workaround but I would hate to advise those and highly recommend adding a Calendar dimension in your model.

 

Follow us on LinkedIn

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Greg_Deckler
Super User
Super User

@JLEmlet Well, maybe try this equivalent:

Sales RT =
  VAR __MaxDate = MAX('GA'[CalendarDateTime])
  VAR __Table = FILTER('GA', 'GA'[CalendarDateTime] <= __MaxDate)
RETURN
  SUMX(__Table,[Sales])


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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.