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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

How do I COUNT created minus COUNT archived

Hi,

 

This is probably quite simple, but I have been using other BI tooling the last few weeks and I'm a bit out of my power bi rythm 🙂

I have a table with the following info:

 

File No. | Date created | Date Archived

1           | 01-01-2021 | 01-02-2021

2           | 01-02-2021 | 01-03-2021

3           | 01-02-2021 | 01-03-2021

 

I want to have a graph that shows the amount of currently active files.

So that would be COUNT (File No.) on Date created MINUS Count File No. on Date Archived

 

How can I achieve the below graph with amount of active files per month? I need to combine the dates but I cant figure out how

JVDS_0-1617351920952.png

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , You need to create a common date table and join both dates with that. One join will be inactive, that you have to activate in a measure using use relationship

refer to my blog, how to use

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970

or

video - https://www.youtube.com/watch?v=e6Y-l_JtCq4

 

Or refer blog -https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in-power-bi

View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please try the below measure.

Counting active files = 

calculate ( countrows(table), filter (values (createddate), createddate <= max(datetable date)),

filter (values (archive date), archive date > min(datetable date)))

 

In this case, the relationship between the table and the date-table has to be inactive ( or no relationship).

 

if it is OK with you, please share your sample pbix file, then I can try to come up with a more accurate measure.

 

thank you.

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


amitchandak
Super User
Super User

@Anonymous , You need to create a common date table and join both dates with that. One join will be inactive, that you have to activate in a measure using use relationship

refer to my blog, how to use

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970

or

video - https://www.youtube.com/watch?v=e6Y-l_JtCq4

 

Or refer blog -https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in-power-bi

Anonymous
Not applicable

Thanks amit, I'll have a look and see if this is the solution to my problem. Will mark later if so!

 

Edit: Apart from the extra conditions I have in my dataset which I will add manually was this exactly what I needed. Great explanation and awesome content Amit!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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