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
Andvil
Helper V
Helper V

Visual total not matching sum of individual rows when filtering

Good afternoon community,

 

I have a report that includes sales codes and I need my visuals to show the distinct count of the sales codes. I used to filter by month and then realized than in the distinct count formula I need to force a row by row context, as whenever I applied the month filter the visual distinct count total didn´t match the row by row sum.

 

I applied this formula and when filtering by month, the row by row sum was equal to the distinct count total: 

 

 

SumX Measure = 
SUMX(
    VALUES( 'Dates Table'[YearMonthnumber] ),
    CALCULATE(
        DISTINCTCOUNT( '2020'[Sales Code] )
    )
)

 

 

However, now I need to use other filters rather than only the month, but when I filter according to  other variables, again I have the problem that the distinct count total is not matching the row by row sum. I need the visual to have the correct distinct count total (matching with the row by row sum) by selecting different filters.

 

I attach an example so you can better understand what I need to do, my file includes the filters I usually apply and other dax formulas I have tried: Distinct Count Error 

 

I previously posted this example to ask for help to filter by month and have the correct grand total. My post´s title is "visual total not matching sum of individual row ", now I need further help to apply other filters besides the month.

 

I would really appreciate your answers and help.

 

Best wishes,

Jalv

 

6 REPLIES 6
v-shex-msft
Community Support
Community Support

HI @Andvil ,

It seems your formula only considers the filter effect which you defined in values function. If you want to keep other filter effects, You can try to use allselected instead: (notice: please double check the relationships key between the current table and that table if filter works on other table fields)

SumX Measure = 
SUMX(
    ALLSELECTED( 'Dates Table'),
    CALCULATE(
        DISTINCTCOUNT( '2020'[Sales Code] )
    )
)

Managing “all” functions in DAX: ALL, ALLSELECTED, ALLNOBLANKROW, ALLEXCEPT 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi @v-shex-msft ,

 

I tried that formula and did not work. It is the column with the title All Selected. Regarding the relationships, the dates table filters the 2020 table.

 distinct count.png

 

Even when I open more detail, the whole column has the 210 value.

 

Best,

JALV

Hi @Andvil,

Please share some dummy data with raw table structure and relationships, it is hard to do further test without sample data.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
amitchandak
Super User
Super User

@Andvil , you might have to replicate the thing for another group by too, in case you need sum.

Hi @amitchandak  can you explain me please the group by?

Hi @amitchandak 

 

I did not understand, how do I replicate for another group?

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.