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
ZakariAK
Regular Visitor

Filters don't return the correct count

Im calculating some total values doing a count and filtering the rows with duplicate values in one column (Id Cliente)

 

When calculating the total without filters the row count is correct, but when adding filters i get wrong values.

 

 

When doing the count without filtering out any values I receive the correct number of rows: 4844

total cupones.PNG

count excel.PNG

 

But when applying filters to filter out row that contain a certain value i receive the wrong count (80 values more than what it should)

 

total with filtering.PNG

This is what i should receive: 3513

cuenta con filtro.PNG

 

Its clear its a problem with the filters but i don't grasp what its not adding up, can someone help me or give me the correct DAX measure?

 

Thanks in advance.

3 REPLIES 3
ZakariAK
Regular Visitor

Hi,

 

The count I made is already returning it correct, the problem I have is when filtering out some rows depending of its value in a column.

ariba_m
Regular Visitor

Hi there,

As per my understanding of the problem, you are trying to get a count of distinct values based on a column. 


Try this measure:

 

For count of distinct values:

MeasureName = COUNTROWS(ALL([TableName][ColumnName]))

Example: Measure = COUNTROWS(ALL(Product_Table[return_date]))


Output:

ariba_m_5-1701848019837.png

 

ariba_m_4-1701847736405.png

 

Hope this helps!

 

 

Hi,

 

The count I made is already returning it correct, the problem I have is when filtering out some rows depending of its value in a column.

'''Total Cupones =
CALCULATE(
    COUNTROWS(
        SUMMARIZE(
            CRM,
            CRM[Id Cliente]
        )
    ),
    NOT(
        CRM[Promocion Periodo Cupon] IN {"OPPRCC - Petición reabrir cupón", "RPRCUP - Recupón", "RPRCUP - Recup��n"}
        || CRM[Motivo de cierre] IN {"G - Gestión Solicitud", "Gestión de solicitud"}
    )
)'''

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.