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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Khomotjo
Helper II
Helper II

Measure over 2 dates with a many to many relationship

Hello Everyone, I am building a dashboard from  a database. I have 2 date fileds: required date and finalised date. I have measures in my table that were calculated based on required date ( such as open orders on the day/late orders on the day). I want to add a coloumn to this table for all orders finalised on the day.  The issue is that not all orders finalised on a particular  date were required on the date. Sometimes the we work ahead or catchup on orders. I thought of doing a loop over finalised date and counting all entries that match a specific date but not sure how to add this back as a coloumn to the table I have created for other KPIs using required date. Thanks,

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@Khomotjo You can try using create a calculated column in your table that counts the number of orders finalized on each day

DAX
FinalizedOrdersOnDay =
CALCULATE(
COUNTROWS(OrdersTable),
FILTER(OrdersTable, OrdersTable[FinalisedDate] = EARLIER(OrdersTable[RequiredDate]))
)

 

If you prefer to create a measure instead of a calculated column, you can use the following DAX formula:

DAX
FinalizedOrdersOnDayMeasure =
CALCULATE(
COUNTROWS(OrdersTable),
FILTER(ALL(OrdersTable), OrdersTable[FinalisedDate] = MAX(OrdersTable[RequiredDate]))
)

 

Once you have created the measure, you can add it to your table visual in Power BI. This will display the count of orders finalized on each required date alongside your other KPIs.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

3 REPLIES 3
Khomotjo
Helper II
Helper II

Thanks @bhanu_gautam  it worked perfectly. Quick question :  Does it matter if I use a calculated coloumn or a measure? Which one is best practise or is it a matter  only of preference?

Calculated columns will take space and measure are quick, calculated columns are used for row iteration




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






bhanu_gautam
Super User
Super User

@Khomotjo You can try using create a calculated column in your table that counts the number of orders finalized on each day

DAX
FinalizedOrdersOnDay =
CALCULATE(
COUNTROWS(OrdersTable),
FILTER(OrdersTable, OrdersTable[FinalisedDate] = EARLIER(OrdersTable[RequiredDate]))
)

 

If you prefer to create a measure instead of a calculated column, you can use the following DAX formula:

DAX
FinalizedOrdersOnDayMeasure =
CALCULATE(
COUNTROWS(OrdersTable),
FILTER(ALL(OrdersTable), OrdersTable[FinalisedDate] = MAX(OrdersTable[RequiredDate]))
)

 

Once you have created the measure, you can add it to your table visual in Power BI. This will display the count of orders finalized on each required date alongside your other KPIs.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.