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

Countrows not working as expected

Hello,

 

Within DAX I am trying to calculate the amount of days a Client is connected to one of the Dimensions. So for example how many times a Client is connected to a certain team within a certain timeframe.

Rocco_z_2-1625052392484.png

This must give the result of 3. Within this time period the Client 2. Is connected 3 times to Team 3.

 

As you can see in the example below, my solution does not work (check below for measure). The yellow marked totals needs to be the sum of all underlying Clients. Now it only gives the max amount of days within that month. Can someone please explain what is going wrong?

Rocco_z_3-1625052772694.png

 

Measure I am now using: 

CALCULATE(COUNTROWS(Dim_Date), FILTER(Fact_Client, Fact_Client[Client_ID] <> blank() ))

 

Thanks!

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

What kind of data do you want to display in the subtotal section?

 

If you want to calculate how many days you have contact with different teams in this month, then I think your measure is correct.

 

Take a look at the following example data. In December, there are 29 days including Team_ID = 1, and the return value of the measure is also 29.

 

vkkfmsft_0-1625218731035.pngvkkfmsft_1-1625218762730.png

 

Best Regards,
Winniz

 

View solution in original post

3 REPLIES 3
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Create the new measure:

 

Total = 
IF(
    ISFILTERED(Fact_Client[Team_ID]),
    [Measure],
    SUMX( ALLSELECTED(Fact_Client[Team_ID]), [Measure] )
)

image.png

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

 

Anonymous
Not applicable

Thanks Winniz for your answer.

But unfortunately this does not completely solves the problem.

 

test_measure = CALCULATE(COUNTROWS(Dim_Date), FILTER(Fact_Client, Fact_Client[Client_ID] <> blank() ))
Total = IF(ISFILTERED(Fact_Client[Team_ID]),[test_measure],SUMX( ALLSELECTED(Fact_Client[Team_ID]), [test_Measure] ))

Rocco_z_0-1625210884340.png

As you can see in the example above. The totals does not show what I want. For example in the left table the totals are still 31 for the Team_A totals. In the right table the totals for example Client_A for City_A is 73, while there only 31 days within the month 2019-12.Capture.PNG

Above you can see the data model, it also contains more then 1 dimension. So the measure also need to be dynamic while switching with dimensions in your table.

 

Thanks!

 

 

Hi @Anonymous ,

 

What kind of data do you want to display in the subtotal section?

 

If you want to calculate how many days you have contact with different teams in this month, then I think your measure is correct.

 

Take a look at the following example data. In December, there are 29 days including Team_ID = 1, and the return value of the measure is also 29.

 

vkkfmsft_0-1625218731035.pngvkkfmsft_1-1625218762730.png

 

Best Regards,
Winniz

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.