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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
MuFeR
Regular Visitor

Filtering Data to Determine User Access on Specific Dates

Hello, I'm a beginner in PowerBI and i got asked to try and create a couple reports. I'm not really sure what would be the correct terminology for what I'm trying to do so didn't have much luck when googling for something similar.

 

So the scenario is:
There's an existing application where all "access requests" go through and are stored in a database.
There are 3 types of requests (Grant access/modify access/revoke access).
The db looks like this (has lots of other stuff but they're irrelevant)

UserID SystemIDRequestTypeRequestCompletionDate
JohnSystem 1Grant access01/01/2022
JohnSystem 1Revoke access01/01/2023
JohnSystem 1Grant access01/01/2024

 

Based on this info we can deduce that John had access on System 1 between 01/01/2022 and 31/12/2022, then didn't have access from 01/01/2023 until 31/12/2023 since his access was revoked on 01/01/2023, and now he currently has access as the latest request granted him access on 01/01/2024.

 

So the requirements are to create 3 pages:

1)A page where you can select a system from a slicer and see all users who currently have access on that system (my approach would be somehow to find all users who got a request for that system and where the latest RequestType is not "Revoke").
2)Pretty much same thing as #1 but for a specific date instead for today, for example see who had access on "System 1" on 05/05/2023.

3)Again same thing but for a time period, as in who had access on "System 1" at any point in 2023.

 

What I ended up doing was create a table, use the Group by wizard as shown below and keep only the rows where the type is not "Revoke" which covers requirement #1 but no idea how to approach the other 2.

MuFeR_0-1714499888091.png

 

1 ACCEPTED SOLUTION
v-jialongy-msft
Community Support
Community Support

Hi @MuFeR 

 

For your second requirement, you can create the following measure to determine if the system was accessed on the specific date.

Today = IF(SELECTEDVALUE('Table'[RequestCompletionDate])=TODAY()&&SELECTEDVALUE('Table'[RequestType])="Grant access",1,0)

Then you can filter the value of measure in the filter.

vjialongymsft_0-1716794760637.png

Result:

vjialongymsft_1-1716794783737.png

 

 

For your third requirement you can use the following measure to determine who has access to the system for the duration of an entire year.

Time period = IF(COUNTROWS('Table')=1 && SELECTEDVALUE('Table'[RequestType])="Grant access",1,0)

 

You can then filter the corresponding values in the filter and work with the slicer to achieve the results you want.

vjialongymsft_2-1716795006857.png

vjialongymsft_3-1716795015014.png
vjialongymsft_4-1716795029849.png





Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

5 REPLIES 5
v-jialongy-msft
Community Support
Community Support

Hi @MuFeR 

 

For your second requirement, you can create the following measure to determine if the system was accessed on the specific date.

Today = IF(SELECTEDVALUE('Table'[RequestCompletionDate])=TODAY()&&SELECTEDVALUE('Table'[RequestType])="Grant access",1,0)

Then you can filter the value of measure in the filter.

vjialongymsft_0-1716794760637.png

Result:

vjialongymsft_1-1716794783737.png

 

 

For your third requirement you can use the following measure to determine who has access to the system for the duration of an entire year.

Time period = IF(COUNTROWS('Table')=1 && SELECTEDVALUE('Table'[RequestType])="Grant access",1,0)

 

You can then filter the corresponding values in the filter and work with the slicer to achieve the results you want.

vjialongymsft_2-1716795006857.png

vjialongymsft_3-1716795015014.png
vjialongymsft_4-1716795029849.png





Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

lbendlin
Super User
Super User

How many users?  How many entries in the access reference table?

 

You may not need to torture Power Query for that (except maybe to indicate From/To periods).

About 400 users and 10000 access records.

Can you refactor the access records into Grant - Revoke pairs  (with the last revoke being null for active access) ?

I'll give that a shot.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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