Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
So, my company data base has a table called "historical_cost_center", it's main objective is to register where the employee worked in a given date.
COST_CENTER | ID | WORKER | ALTERATION_DATE |
498000 | 10010 | ADRIAN | 04/20/2024 |
420105 | 10010 | ADRIAN | 06/01/2024 |
420047 | 10010 | ADRIAN | 09/01/2024 |
401022 | 43930 | STEINHAUSER | 06/24/2024 |
110014 | 19241 | ZIELLO | 05/23/2024 |
420078 | 19241 | ZIELLO | 07/01/2024 |
Looking at Adrian example, he worked in three different cost_center throught the year.
If my user filters for Adrian but want to see which cost center he is currently working (meaning, the user will want to see Today's date), it will return a BLANK, because the alteration date is for 09/2024, and we are currently in 10/2024.
Both filters in the images below are made through Calendar[Year] and Calendar[Month Name]:
The user filters by the same month (September) as that the alteration_date:
Now the user filters by a month (October) different from the alteration_date:
The goal here is to retrieve the current cost_center the employee is working on. Meaning that the result should be something like:
MONTH | CURRENT | DESIRED |
April | 498000 | 498000 |
May | BLANK | 498000 |
June | 420105 | 420105 |
July | BLANK | 420105 |
August | BLANK | 420105 |
September | 420047 | 420047 |
October | BLANK | 420047 |
Solved! Go to Solution.
Glad to hear your colleagues are able to provide an alternative solution @PauloRicardo!
Out of curiosity I had another look and wasn't able to replicate my solution from before, however with an adjusted measure it did return the right values. This removes the filters from the Calendar table and then uses the latest date from Calendar (either from selection or the max date in the table) to filter the latest ALTERATION_DATE. This is then used to for retrieving the corresponding cost center.
and this is the model created for it:
It could probably be made more efficient, but just wanted to make the measure that does the job.
Hey @PauloRicardo ,
With the following measure I was able to replicate the scenario. In the measure, first the latest alteration date is calculated for each worker, and then in a second step, return the coster center for that latest date value.
Hi, @DanielW_ ,
Sorry for not answering earlier. I've tried your measure but yet it didn't returned the expected value.
I've already talked to the IT team and they decided to create a new table with the current cost_center month for month. Anyway, i appreciate your attention in helping me.
Glad to hear your colleagues are able to provide an alternative solution @PauloRicardo!
Out of curiosity I had another look and wasn't able to replicate my solution from before, however with an adjusted measure it did return the right values. This removes the filters from the Calendar table and then uses the latest date from Calendar (either from selection or the max date in the table) to filter the latest ALTERATION_DATE. This is then used to for retrieving the corresponding cost center.
and this is the model created for it:
It could probably be made more efficient, but just wanted to make the measure that does the job.
Hi @DanielW_ , good to hear from you again!
And it worked! The "ALL" function really did a difference.
Thanks for the support! It will help many others with the same issue.
you can write a column to find out the finished date as follows:
Hi, @Selva-Salimi ,
Sadly the values still come out as blank.
This is the result of the calculated column:
Here are the results for the measure presented:
Is there anything i can do to help?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
146 | |
87 | |
66 | |
52 | |
46 |
User | Count |
---|---|
215 | |
90 | |
83 | |
66 | |
58 |