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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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