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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Meeshe
Frequent Visitor

Countrows with removefilters not working as it should

I have the following DAX measure to display a row count figure on a card. There are two slicers, one for the Offer Date (using an all dates table) and one for the Status. When selecting a date range in the Offer Date filter, e.g. 01/02/2024-06/02/2024, it should output a figure of 26. When the Status filter is selected as well as the Offer Date filter, e.g. Accepted, it changes the figure to something completely unrelatable (19!), meaning the DAX measure DOES NOT IGNORE other filters as expected.

 

CALCULATE(
    COUNTROWS(TestData),
    REMOVEFILTERS(TestData),
    VALUES(TestData[OfferDate])
)
 
 
IDStatusOfferDate
29533Under Offer06/02/2024
29532Under Offer06/02/2024
29531Under Offer06/02/2024
29530Under Offer06/02/2024
29529Under Offer06/02/2024
29528Under Offer06/02/2024
29527Under Offer06/02/2024
29525Under Offer05/02/2024
29523Under Offer05/02/2024
29522Under Offer05/02/2024
29505Under Offer05/02/2024
29504Under Offer05/02/2024
29502Accepted05/02/2024
29501Under Offer05/02/2024
29499Under Offer05/02/2024
29498Under Offer02/02/2024
29497Under Offer02/02/2024
29496Under Offer02/02/2024
29493Declined02/02/2024
29492Accepted02/02/2024
29491Under Offer01/02/2024
29490Under Offer01/02/2024
29489Let01/02/2024
29488Declined01/02/2024
29486Under Offer01/02/2024
29485Accepted01/02/2024
29483Under Offer31/01/2024
29482Under Offer31/01/2024
29481Under Offer31/01/2024
29480Under Offer31/01/2024
29479Accepted31/01/2024
29478Under Offer31/01/2024
29477Under Offer31/01/2024
29476Under Offer31/01/2024
29475Declined31/01/2024
29474Under Offer31/01/2024
29473Under Offer31/01/2024
29472Let30/01/2024
29471Under Offer30/01/2024
29470Under Offer30/01/2024
29469Under Offer30/01/2024
29468Accepted30/01/2024
29467Under Offer30/01/2024
29466Under Offer30/01/2024
29465Under Offer30/01/2024
29464Under Offer30/01/2024
29463Under Offer30/01/2024
29462Accepted30/01/2024
29461Accepted30/01/2024
29460Declined30/01/2024
29459Let29/01/2024
29458Under Offer29/01/2024
29457Under Offer29/01/2024
29456Under Offer29/01/2024
29455Declined29/01/2024
29454Under Offer29/01/2024

 

Thank you for any insight 🙂

1 ACCEPTED SOLUTION
Meeshe
Frequent Visitor

Thank you for all your replies. I found the following DAX works, I don't know how....but it works!

 

  CALCULATE(
        CALCULATE(CountRows(AllocationOffersData),AllocationOffersData,Values(AllocationOffersData[Offer Date])), -- Calculates number of rows with the filter for Offer Date
        REMOVEFILTERS((AllocationOffersData[Offer Status]) -- Clears the filter for Status
)

View solution in original post

5 REPLIES 5
Meeshe
Frequent Visitor

Thank you for all your replies. I found the following DAX works, I don't know how....but it works!

 

  CALCULATE(
        CALCULATE(CountRows(AllocationOffersData),AllocationOffersData,Values(AllocationOffersData[Offer Date])), -- Calculates number of rows with the filter for Offer Date
        REMOVEFILTERS((AllocationOffersData[Offer Status]) -- Clears the filter for Status
)
v-xuxinyi-msft
Community Support
Community Support

Hi @Meeshe 

 

I added the date table as a slicer.

vxuxinyimsft_1-1707389734787.png

 

You can try the following measure:

countRows = CALCULATE(COUNT('Table'[ID]), FILTER(ALL('Table'), [OfferDate] >= MIN('Date'[Date]) && [OfferDate] <= MAX('Date'[Date])))

 

vxuxinyimsft_0-1707389703566.png

Is this the result you expect?

 

Best Regards,
Community Support Team _Yuliax

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you so much. The dates would come from user input slicers. I did find some DAX that worked in the end:

 

  CALCULATE(
        CALCULATE(CountRows(AllocationOffersData),AllocationOffersData,Values(AllocationOffersData[Offer Date])), -- Calculates number of rows with the filter for Offer Date
        REMOVEFILTERS((AllocationOffersData[Offer Status]) -- Clears the filter for Status
)
Meeshe
Frequent Visitor

Apologies, I'd written it in a hurry and updated it now - thank you for your response.

lbendlin
Super User
Super User

Your DAX is a bit redundant.  Please explain what you are actualy trying to compute.  What is the expected outcome based on the sample data?

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors