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

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.

Reply
tomislav_mi
Helper II
Helper II

How to find the most frequent value (through blanks as well)

Hey guys,

Can you please advise:

I have a table that looks like this and I would need to get the column in orange - the most frequent revenue value for Customer (disregarding blank values.)

CustomerAccountRevenueMost Frequent Value
Aaa150000298700
Abb298700298700
Acc0298700
Add298700298700
Aee298700298700
Aff300298700
BF34(blank)250
BT45250250


Hope this could be solved somehow?

Many thanks!

1 ACCEPTED SOLUTION

Hi @tomislav_mi ,

You can create two measures as below:

Count of revenue = 
CALCULATE (
    COUNT ( 'Revenue'[Revenue] ),
    ALLEXCEPT ( 'Revenue', 'Revenue'[Customer], Revenue[Revenue] )
)
Most Frequent Value = 
VAR _max =
    MAXX ( ALLEXCEPT ( 'Revenue', 'Revenue'[Customer] ), [Count of revenue] )
RETURN
    CALCULATE (
        MAX ( 'Revenue'[Revenue] ),
        FILTER (
            ALL ( 'Revenue' ),
            'Revenue'[Customer] = MAX ( 'Revenue'[Customer] )
                && [Count of revenue] = _max
        )
    )

get the most frequent value.JPG

Best Regards
Community Support Team _ Rena Ruan
If this post helps, then please consider Accept it as the solution to help the other members find it more.

Community Support Team _ Rena
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
AntrikshSharma
Community Champion
Community Champion

@tomislav_mi For most recent value there should be a date associated with it, do you have it? Otherwise a solution can still be prepared but it will break if the logic doesn't fits later.

Hey,

thank you for your response.

Not most recent but most frequent value so there is no date in this table.

Hi @tomislav_mi ,

You can create two measures as below:

Count of revenue = 
CALCULATE (
    COUNT ( 'Revenue'[Revenue] ),
    ALLEXCEPT ( 'Revenue', 'Revenue'[Customer], Revenue[Revenue] )
)
Most Frequent Value = 
VAR _max =
    MAXX ( ALLEXCEPT ( 'Revenue', 'Revenue'[Customer] ), [Count of revenue] )
RETURN
    CALCULATE (
        MAX ( 'Revenue'[Revenue] ),
        FILTER (
            ALL ( 'Revenue' ),
            'Revenue'[Customer] = MAX ( 'Revenue'[Customer] )
                && [Count of revenue] = _max
        )
    )

get the most frequent value.JPG

Best Regards
Community Support Team _ Rena Ruan
If this post helps, then please consider Accept it as the solution to help the other members find it more.

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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