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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
kneri3
Frequent Visitor

Changing a calculated field based off date filter

Hello,

 

I am working with employee data, more specifically, looking at Active vs. Terminated employees in a certain time period. Everything is dependent on the date filter. I have a hire date and termination date and I created a calculated measure (see below) to decide whether that person was active or terminated in the time frame.

 

kneri3_0-1666302989088.png

 

This correctly gives me what I am looking for. The issue is that I cannot create any visuals/filters off this measure. I can only put it in a table. My whole analysis is centered around the number of actives/terminated in a certain group/over time/etc. So I have to be able to do counts of active and terminated, see it over time, broken out by group, etc. 

 

I found an article that had me create a column and give it the value of the measure:

 

kneri3_2-1666303189694.png

 

After creating the column, it had me create a table with those values:

 

kneri3_3-1666303219171.png

 

then create another measure:

 

kneri3_1-1666303129598.png

This allows me to now be able to see active vs. terminated within visuals. 

 

However, this does not update when I change the date criteria. It is static because of the GT formula from above assigns a static value for each row.

 

This brings me back to my original issue of then not being able to dynamically see who was active/terminated during a certain time frame.

 

Can anyone give me any idea what to do in this situation? I copied dummy data that has the same fields as my dataset as well as an example of the filter. The table shows the measure 'conditional date_2' which dynamically changes as the 'original hire date' filter is applied. Again, I can't create any other visuals off of the measure.

 

Thank you in advance!

 

kneri3_4-1666303769873.png

 

NameManagement_LevelHire DateTermination DateConditional Date_2Count of Full_Name
John Smith12 Individual Contributor04/18/2022 0:0005/24/2022 0:00Terminated1
Judy Chapman8 Director06/27/2007 0:0003/20/2009 0:00Terminated1
Kelsey Patel12 Individual Contributor03/09/2020 0:00 Active1
Mads Lightner12 Individual Contributor07/06/2021 0:00 Active1
Ryan Cox12 Individual Contributor10/07/2019 0:0011/30/2021 0:00Terminated1
Ashish Goodman12 Individual Contributor06/06/2022 0:0008/26/2022 0:00Terminated1
Joseph Jones12 Individual Contributor05/13/2008 0:0007/31/2011 0:00Terminated1
JJ White12 Individual Contributor06/07/2021 0:00 Active1
Jennifer Lewis12 Individual Contributor04/29/2019 0:0012/03/2021 0:00Terminated1

 

3 REPLIES 3
Greg_Deckler
Super User
Super User

@kneri3 
Take a look at these two Quick Measures as I think you want something like them.

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


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thank you for providing these. I leveraged your formula. See below:

kneri3_0-1666366207359.png

 

However, I am getting an error and I think it has something to do with the fact that I am doing an employee count and not summing an amount. I added a column, 'Employee Count' and gave it a value '1' and I thought then it would sum, but I keep receiving this error: 

kneri3_1-1666366274220.png

 

kneri3
Frequent Visitor

@Greg_Deckler I was able to figure out the issue. There were blank dates in termination that caused it to error out. I was wondering if you have any idea why the status count total is saying 56 (bottom right table), instead of 11, which is what it is showing?

kneri3_0-1666729820161.png

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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