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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
pborah
Solution Sage
Solution Sage

count, avg, max, min of transactions per day

I have two columns - transaction number and transaction date. There are transactions happening every single day including weekends.

 

I want to show the following information in individual cards by calculating one measure - transactions per day using the fundtion -(Calculate(Count(table[transaction number]),AllExcept(table, table[transaction date]))

 

- avg transactions per day

- max transactions per day

- min transactions per day

 

There is a Yearly Quarters filter on report level. For Q12020 there were 91 days since 2020 is a leap year. However the average metric that I get is for 90 days. There were 40783 transactions for the specific quarter. That divided by 91 yields 448, but the metric on the card is 452 which is the total divided by 90. I went back to the sql db to see if there was any issues with the lookup table that assigns quarter to dates, everything is fine there, it shows Q12020 as having 91 days. Interesting but obvious find - Datediff between the starting date and ending date yields 90 days but a distinct count of transaction dates yields 91. Creating a new table for solving this issue  using SUMMARIZE results in metrics that are completely off, so I would like to avoid that if possible. Basically what I would like is a simple way of calculating transactions per day as a measure so that I can drop that into 3 cards and choose avg, max, and min of that. It's so easy to do in SQL but I've been stuck on this for days now PowerBI. Thank you very much.

 

1 ACCEPTED SOLUTION

@pborah This is what you need in measures and use in card visual

 

Base Measure = COUNTROWS ( Table )

Max = maxx(values(Table[Date]),[Base Measure] )

Min = minx(values(Table[Date]),[Base Measure]

Avg = averagex(values(Table[Date]),[Base Measure]

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos 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
amitchandak
Super User
Super User

@pborah , Try like

maxx(values(Table[Date]),countrows(Table))

minx(values(Table[Date]),countrows(Table))

averagex(values(Table[Date]),countrows(Table))

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

@amitchandak , I tired out the solution you provided for average, however that actually gave me total transactions for the quarter when I dropped that measure on to a card.

 

Besides, I just want to calculate total transactions per day. Then I can drop that number on three different cards and have each of them display the avg, min, and max of total transactions per day by choosing the appropriate aggregation under Field settings. Thank you.

@pborah This is what you need in measures and use in card visual

 

Base Measure = COUNTROWS ( Table )

Max = maxx(values(Table[Date]),[Base Measure] )

Min = minx(values(Table[Date]),[Base Measure]

Avg = averagex(values(Table[Date]),[Base Measure]

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos 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.

@parry2k that works beautifully thank you!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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