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
BigLo
Helper III
Helper III

count active elements items between 2 dates

Hello,

 

I want to count the number of active elements between 2 dates. I have their activity start date and their activity end date.

My goal is to make a line graph with the number of active elements per day. 

 

I must be able to integrate slicers on the type, cat, ...

 

A sample of data.

 

For example, 2021-02-12 (1 item) and 2021-02-13 (2 items)

 

BigLo_0-1626269442686.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @BigLo ,

I'm so sorry that I made a mistake on the formula of measure. Is there anything else about this thread need help from my side? If it is all ok now, could you please mark it Answered now? It will help the others in the community find the solution easily if they face the same problem with you. Thank you.

Best Regards

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @BigLo ,

I created a sample pbix(see attachment) for you, please check whether that is what you want.

1. Create a date dimensio table

Date = CALENDAR(MIN('Table'[Start]),MAX('Table'[End]))

2. Create a measure to get the count of the active elements

Active items = 
CALCULATE (
    DISTINCTCOUNT ( 'Table'[Id] ),
    FILTER (
        'Table',
        'Table'[Start] >= SELECTEDVALUE ( 'Date'[Date] )
            && 'Table'[End] >= SELECTEDVALUE ( 'Date'[Date] )
    )
)

3. Create a line chart( Axis: Date(From date dimension table)  Values: Measure)

yingyinr_0-1626419488217.png

Best Regards

I think it is not correct or my explanation was not clear. 

 

In the Beginning, all items are active. 

BigLo_0-1626422606947.png

I changed the comparison sign and everything is OK. so thanks, I never found without your help.

 

BigLo_1-1626422788459.png

 

BigLo_2-1626422966549.png

 

 

 

 

 

Anonymous
Not applicable

Hi @BigLo ,

I'm so sorry that I made a mistake on the formula of measure. Is there anything else about this thread need help from my side? If it is all ok now, could you please mark it Answered now? It will help the others in the community find the solution easily if they face the same problem with you. Thank you.

Best Regards

Pragati11
Super User
Super User

Hi @BigLo ,

 

Few questions:

  • what is the definition of ACTIVE elements between 2 dates? you haven't mentioned it.
  • The screesnhot of the data doesn't help us if we want to try it at our end. Please attach sample data as a file attachment so that it can easily be imported to Power BI.

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Thanks,

 

Here is the file https://1drv.ms/x/s!AnCIbCo-paOMh0xCJDd-hfe73cfL?e=EHTCoO 

 

an item is active on the start date until the end date.
For example: the active start of id 1 is 2021-02-01 and its active end is 2022-07-03.

Helpful resources

Announcements
Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

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.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.