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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Shliim_1
Frequent Visitor

Filter upon a calculated column or build a calculated column on a calculated column.

Hi, 

 

I have a large table that looks something like this: 

 

Latest_record_countNumber_of_columns_filledclientIDas_of_datedata_about_client
3231  
4221  
1222  
2222  
2223  
3233  

 

The column "Latest_record_count" returns the most recent row and the column. "Number_of_columns_filled" gives me the most complete dataset (the higher the value, the more recent the data).

 

A lot of preprocessing is done in Python, but further preprocessing is out of the question due to the need to keep track of historical occurrences.

 

I need Power BI to return, for every ID, the row with the maximum number of rows filled. Then, based on that, I can filter the dataset to find the maximum value that occurs within this filtered dataset.

It's possible for the maximum value in "Latest_record_count" to be lower than the absolute maximum value of the latest record count.

I want to obtain a table that shows the following:

 

Latest_record_count   Number_of_columns_filled  clientID  as_of_date  data_about_client
3 231  
4 221  
1 222  
2 222  
2 223  
3 233  

 

Whenever I do these steps manually in excel and compare this in a table generated in PowerBI I get totally different results. 

this because I cant get PowerBI filter upon an already filtered datatable.  Moreover this in total needs to function as a filter and not as a table. 

 

I eventually want to calculate multiple things like: distintcounts, averages etc based on this filter where there will be a visual that even more cuts into the data with the as_of_date column (BTW the as_of_data is in principle the same as Latest_record_count) but for certain calculations it makes it way easier to use integers. 

 

hopefully someone could help me. 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

@Hi @Shliim_1 

Please refer to attached sample file for the proposed solution

1.png

FilterMeasure = 
COUNTROWS (
    FILTER ( 
        'Table',
        MAXX (
            TOPN ( 
                1,
                CALCULATETABLE ( 'Table', ALLEXCEPT ( 'Table', 'Table'[clientID] ) ),
                'Table'[Number_of_columns_filled]
            ),
            'Table'[Latest_record_count]
        ) = 'Table'[Latest_record_count]
    )
)

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

@Hi @Shliim_1 

Please refer to attached sample file for the proposed solution

1.png

FilterMeasure = 
COUNTROWS (
    FILTER ( 
        'Table',
        MAXX (
            TOPN ( 
                1,
                CALCULATETABLE ( 'Table', ALLEXCEPT ( 'Table', 'Table'[clientID] ) ),
                'Table'[Number_of_columns_filled]
            ),
            'Table'[Latest_record_count]
        ) = 'Table'[Latest_record_count]
    )
)

Thx!!! works like a charm 😃

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.