Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I need to show which record is the 'active' record when using a dynamic date slicer
No two records for an employee overlap position starts
Say I had a date with a date range of April 2012 to May 2013 the current active record would be
592342 | Joe Bloggs | 1/04/2012 | 1/05/2013 | Contract |
Say I had a date slicer with a date range of September 2019 - October 2020 the current active record would be
592342 | Joe Bloggs | 16/09/2019 | 19/10/2020 | Part-time |
Employee number | Name | Position start date | Position end date | Employment Basis |
592342 | Joe Bloggs | 1/04/2012 | 1/05/2013 | Contract |
592342 | Joe Bloggs | 2/05/2013 | 3/05/2015 | Part-time |
592342 | Joe Bloggs | 4/05/2015 | 15/09/2019 | Full-time |
592342 | Joe Bloggs | 16/09/2019 | 19/10/2020 | Part-time |
592342 | Joe Bloggs | 20/10/2020 | Full-time | |
347977 | Sam Bills | 19/10/2019 | 25/12/2020 | Part-time |
347977 | Sam Bills | 26/12/2020 | 15/01/2021 | Casual |
347977 | Sam Bills | 16/01/2021 | 31/12/2021 | Full-time |
@smb711 you have to add this a MEASURE not a COLUMN
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Thank you for your help with troubleshooting, I don't think it is returning the right result: there should be a sum of hundreds of active FTE
Data facts to support:
Filter Employee =
VAR __startDate = MIN ( DateTable[Date] )
VAR __endDate = MAX ( DateTable[Date] )
RETURN
CALCULATE (
COUNTROWS ( PBIPND_vwPosition_Private ),
KEEPFILTERS (
PBIPND_vwPosition_Private[StartDate] >= __startDate
),
KEEPFILTERS (
PBIPND_vwPosition_Private[EndDate] <= __endDate
),
KEEPFILTERS (
NOT ISBLANK ( PBIPND_vwPosition_Private[EndDate] )
)
)
@smb711 try this:
Filter Employee =
VAR __startDate = MIN ( 'Date'[Date] )
VAR __endDate = MAX ( 'Date'[Date] )
RETURN
CALCULATE (
COUNTROWS ( Emp ),
KEEPFILTERS (
Emp[Position start date] >= __startDate
),
KEEPFILTERS (
Emp[Position end date] <= __endDate
),
KEEPFILTERS (
NOT ISBLANK ( Emp[Position end date] )
)
)
✨ Follow us on LinkedIn
Learn about conditional formatting at Microsoft Reactor
My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Thanks this seems to be operating, however, runs into an error:
!A circulate dependency was detected: PBIPND_vwPosition_Private[Column], PBIND_vwPosition_Private[Current FTE], PBIPND_vwPosition_Private[Column].
A circular dependencycy was detected:
A column from the Position vw is getting picked up? Actual FTE is a decimal type column
@smb711 January 2021 is an old version, you need to get at least Aug/Sep 2021 release and today there is Oct 2021 release.
✨ Follow us on LinkedIn
Learn about conditional formatting at Microsoft Reactor
My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Thanks for letting me know, I don't have access to this version from my workplace. Any suggestions on workarounds?
@smb711 Anyhow first and foremost is to solve the issue of why my measure is not working in your case?
What Power BI version you are using? Can you please confirm?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
I have the newest update - version: 2.88.2361.9 64-bit (January 2021)
I think it is the syntax for the variable which is incorrect for my situation and I am not replacing them correctly, could you please replace them using the following field and table names I am using? Apologies
I am not sure what to put in emp as well
Table: PBIPND_vwPositionPrivate
Start date column name: StartDate
End date column name: EndDate
Employee number column name: StaffNumber
Date table name: Date Table
Date column name: Date
Is it because I am referencing two tables
!! The expression contains multiple columns, but only a single column can be used in a true/false expression that is used as a table filter expression
Filter Employee =
VAR __startDate = MIN ( 'Date Table'[Date] )
VAR __endDate = MAX ( 'Date Table'[Date] )
RETURN
CALCULATE (
COUNTROWS (PBIPND_vwPosition_Private ),
KEEPFILTERS (
PBIPND_vwPosition_Private[StartDate] >= __startDate &&
PBIPND_vwPosition_Private[EndDate] <= __endDate &&
NOT ISBLANK ( PBIPND_vwPosition_Private[EndDate] )
)
)
@smb711 assuming you have a date dimension in your model that you will use for the slicer, if not then you can add one using my blog post here Create a basic Date table in your data model for Time Intelligence calculations | PeryTUS IT Solutio...
Create a new measure to filter employees that falls in the selected date range:
Filter Employee =
VAR __startDate = MIN ( 'Date'[Date] )
VAR __endDate = MAX ( 'Date'[Date] )
RETURN
CALCULATE (
COUNTROWS ( Emp ),
KEEPFILTERS (
Emp[Position start date] >= __startDate &&
Emp[Position end date] <= __endDate &&
NOT ISBLANK ( Emp[Position end date] )
)
)
Create a table visual, add all the columns you want in the visual, add a visual level filter, and add above measure and where value = 1 and that will do it.
✨ Follow us on LinkedIn
Learn about conditional formatting at Microsoft Reactor
My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Thanks so much Parry2k for your help with this
I am running into a couple of issues
Scenario
I guess I am trying to identify the max record at a moment in time whether in the past or present.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
94 | |
82 | |
66 | |
59 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |