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
Anonymous
Not applicable

Different results using summarize with filter function and visual level filter

Hello everyone,

 

i'm using a measure with nested summarize to find how many clients are loyal to a product. When i use a dax filter i get a result, when i use the filter in the visual level filter, i get different result . Someone knows what i m doing wrong?

 

Code with dax filter: 

 

% Total loyal Clients = 

    COUNTROWS (
        FILTER (
            SUMMARIZE (
                SUMMARIZE (
                    Filter(database; database[year] = 2018);
                    database[id_client];
                    database[product];
                    "total"; SUM ( database[volume] )
                );
                database[id_client];
                database[product];
                "total %"; SUM ( database[volume] )
                    / CALCULATE ( SUM ( database[volume] ); ALL ( database[product] ) )
            );
            [total %] >= 0,75
        )
    ) /DISTINCTCOUNT(database[id_client])
                
     

 

Code without filter and year 2018 selected as visual level filter:

 

% Total loyal Clients (visual level filter) = 

    COUNTROWS (
        FILTER (
            SUMMARIZE (
                SUMMARIZE (
                    database;
                    database[id_client];
                    database[product];
                    "total"; SUM ( database[volume] )
                );
                database[id_client];
                database[product];
                "total %"; SUM ( database[volume] )
                    / CALCULATE ( SUM ( database[volume] ); ALL ( database[product] ) )
            );
            [total %] >= 0,75
        )
    ) /DISTINCTCOUNT(database[id_client])
                
     

The two measures above give me distincts results 

 

 

I also tried this measure with only one summarize, it gives me the same virtual table(the summarize part), but the measure always return  100%. 

 

% Total loyal Clients (1 summarize) = 

    COUNTROWS (
        FILTER (
                SUMMARIZE (
                    database;
                    database[id_client];
                    database[product];
                    "total %"; SUM ( database[volume] )
                    / CALCULATE ( SUM ( database[volume] ); ALL ( database[product] )
                );
            [total %] >= 0,75
        )
    ) /DISTINCTCOUNT(database[id_client])
                

 Is it possible to make this measure with summarizecolumns??

 

here is an example :  example.pbix

 

Thank you.

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Try not to add calcualated columns inside summarize. Try using:

ADDCOLUMNS(
    SUMMARIZE(..
    ),
"Cal Column Name", [MEASURE]
)

View solution in original post

6 REPLIES 6
AlB
Community Champion
Community Champion

Hi @Anonymous 

 

Can you share the pbix? Otherwise it's kinda hard to see what might be going on

 

Cheers

Anonymous
Not applicable

Hi, i posted a pbix with the example. 

 

Thank you

Anonymous
Not applicable

Try not to add calcualated columns inside summarize. Try using:

ADDCOLUMNS(
    SUMMARIZE(..
    ),
"Cal Column Name", [MEASURE]
)
Anonymous
Not applicable

I tried to use summarize + addcolumns and the results are always 100%.

 

I was missing a calculate inside de addcolumns measure field.

 

Thanks

Anonymous
Not applicable

Yep, that can happen. ADDColumns is an interator, so you need to use CALCULATE to invoke the context transition, if not you get results that dont make sense, well they do given the code, but not what we would expect. Glad you were able to figure it out

 

Anonymous
Not applicable

Yes, here is the link: ex.pbix

Thank you

Helpful resources

Announcements
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.

June 2025 community update carousel

Fabric Community Update - June 2025

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