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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
fonsogijon
Frequent Visitor

Activity Date - Filter Date & Logs

I'm trying to create an activity report in Power BI base on the logs in each data set.

My goal is to be able to filter for Date and #Logs. 

For example I would like to see the datasets where:

  • There is activity greater than any number selected in the slicer
  • Date period selected in the slicer as well

For example: datasets where there is than 10 views in the last month

 

 Captura de pantalla 2024-07-12 144433.jpg

 

My data it is stored in an "Activity table" and the main columns are "DatasetId" and "CreationTime".

Then, I have the following formula to count the logs:

_Logs = COUNT(Activity[CreationTime])

 

I have also a calendar table as follow:

dim_Activity_Date = CALENDAR(MIN(Activity[Date]),MAX(Activity[Date]))

 

At the end, I can get values as this one:

Captura de pantalla 2024-07-12 144731.jpg

 

As you can see, using above filters, we can see the logs for the last month, correctly filter by date. However, this dataset shouldn't be there since the number of logs for this dataset in the last month is 4.

I would like to be able to filter dynamically also and say greater than 10, for example.

 

It needs to be dynamic base on the slicer, as there are some other tables connected to this Activity table, so needs to be filtered by the slicer.

 

Do you have any idea or suggestion?

 

Thank you!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @fonsogijon 

 

Unfortunately that I can not access this link:

vzhengdxumsft_0-1721024086726.png

But here I create a set of sample:

vzhengdxumsft_1-1721024111640.png

Then add a new table:

Table = GENERATESERIES(0,COUNTROWS('Activity'),1)

vzhengdxumsft_2-1721024506668.png

Then add a slicer:

vzhengdxumsft_3-1721024533171.png

And a Measure created:

MEASURE =
VAR _Slicer =
    MIN ( 'Table'[Value] )
VAR _currentID =
    SELECTEDVALUE ( Activity[DatasetId] )
VAR _Count =
    COUNTROWS (
        FILTER ( ALLSELECTED ( 'Activity' ), 'Activity'[DatasetId] = _currentID )
    )
RETURN
    IF ( _Count >= _Slicer, _Count, BLANK () )

The result is as follow:

vzhengdxumsft_4-1721024618298.pngvzhengdxumsft_5-1721024634878.png

 

 

 

Best Regards

Zhengdong Xu
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

3 REPLIES 3
Ritaf1983
Super User
Super User

Hi @fonsogijon 

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
Anonymous
Not applicable

Hi @fonsogijon 

 

Unfortunately that I can not access this link:

vzhengdxumsft_0-1721024086726.png

But here I create a set of sample:

vzhengdxumsft_1-1721024111640.png

Then add a new table:

Table = GENERATESERIES(0,COUNTROWS('Activity'),1)

vzhengdxumsft_2-1721024506668.png

Then add a slicer:

vzhengdxumsft_3-1721024533171.png

And a Measure created:

MEASURE =
VAR _Slicer =
    MIN ( 'Table'[Value] )
VAR _currentID =
    SELECTEDVALUE ( Activity[DatasetId] )
VAR _Count =
    COUNTROWS (
        FILTER ( ALLSELECTED ( 'Activity' ), 'Activity'[DatasetId] = _currentID )
    )
RETURN
    IF ( _Count >= _Slicer, _Count, BLANK () )

The result is as follow:

vzhengdxumsft_4-1721024618298.pngvzhengdxumsft_5-1721024634878.png

 

 

 

Best Regards

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

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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