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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
BTW30s
New Member

Trend line, calculation for each row

Hi,

I have a very complex problem. I'm new to dax but I'm not sure it can solve this.

I have a table of id, start date and end date.
Capture.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Now I need to create snapshot table. I created new date table using function calendarauto. But now I need to calculate column or a measure like so:

If date row from date table is between open and closed date, it will count as 1, otherwise 0.

For example:  id 1, should be calculated for january, february, march and april, for id 2 only in january, and so on...

In chart (or table) values should be:

January: 2,

February: 5,

March: 9,

April: 7

 

I hope I explained it well. Thanks for any help. 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

Because you didn't provide data in a format that I can copy and paste and I don't feel like retyping all of your data, I probably shouldn't attempt to answer this without testing. 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

 

But, here goes. In your Calendar table, create a new column like this:

 

Column = COUNTROWS(FILTER(ALL(Incidents),Incidents[Open Date]<=[Date]&& Incidents[Close Date]>=[Date])) 

I'm fairly sure that is correct. It feels correct.



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...

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

Check out my Open Tickets Quick Measure. Just learned how to elegantly solve these types of problems thanks to @Phil_Seamark's excellent new book, Beginning DAX with Power BI: The SQL Pro’s Guide to Better Business Intelligence. Fantastic resource. Here is the link to the Quick Measure:

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364#M147

 

 



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...
Greg_Deckler
Community Champion
Community Champion

Because you didn't provide data in a format that I can copy and paste and I don't feel like retyping all of your data, I probably shouldn't attempt to answer this without testing. 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

 

But, here goes. In your Calendar table, create a new column like this:

 

Column = COUNTROWS(FILTER(ALL(Incidents),Incidents[Open Date]<=[Date]&& Incidents[Close Date]>=[Date])) 

I'm fairly sure that is correct. It feels correct.



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...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.