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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

count rows with datesbeween

Hi,

I have a table with orders incl startdate and enddate

for different types of orders we have a norm for the duration of the order in workdays

Now i want to count the number of orders that have a "good" or "bad" duratation

 

something like this:

 

on time calculation =
var norm = lookupvalue(norm[norm];ordertype;ordertype)

var ontime =

calculate

countrows(orders);

filter(
calendar;datesbetween;calendar;startdate;enddate;
calendar[isworkday] = 1) < norm)

return ontime

But this didn't work
Can someone help me?

3 REPLIES 3
v-lili6-msft
Community Support
Community Support

hi, @Anonymous 

Sample data and expected output would help tremendously.
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

 

And for datesbetween case, you may refer to this post:

https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365

 

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.
amitchandak
Super User
Super User

You can populate a column in your fact. Please refer, How I have populated in dimension using the fact?

Max Sales order id = Maxx(filter(sales,Sales[item_id]='Item'[Item ID]),Sales[Order Id]) 
Max customer = MAXX(filter(Sales,Sales[Order Id]='Item'[Max Sales order id] && Sales[item_id]='Item'[Item ID]),Sales[Customer ID])

 

Even if you are sure there is one row, you need to have some aggregate function.

 

The information you have provided is not making the problem clear to me. Can you please explain with an example. If possible please share a sample pbix file after removing sensitive information.
Thanks

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
sturlaws
Resident Rockstar
Resident Rockstar

@Anonymous 

 

Could you please post some sample data in text-tabular format? Or, ideally, share the pbix (beware of confidential data)?

 

Cheers,
Sturla

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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
Users online (6,224)