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.
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
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
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.
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
@Andvil , you might have to replicate the thing for another group by too, in case you need sum.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |