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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
EricKautz
Helper I
Helper I

Countrows function for 2 colums

Good afternoon,

 

I am trying to create a measure to count the number of rows that meet 2 different column criteria and the dax equation I'm using is not pulling in the correct total. The count is supposed to meet criteria from 2 columns. First, if a value is greater than 10,000 and the number of days is = 1. I am trying to put this data into a matrix table. The first column has the total number of each Asset Class over 10k, that data is correct. When I add the 2nd measure to the matrix table, its not splitting up the values equal 1 between FX and InterestRate, but giving me the combined total.

This is the formula I used:

MTM Greater than 10,000 and 1 = COUNTROWS(
    FILTER(
        ALL('cftc 10 %'),
        'cftc 10 %'[ABS MTM Difference Value] > 10000 && 'cftc 10 %'[age] = "1"))
 
Chart Data:
Asset ClassABS MTM Difference ValueAge

FX

$25,421.00

1

InterestRate$11,797.002
InterestRate$5,256.004
 
1 ACCEPTED SOLUTION

I hope it'll work for you.

 

MTM Greater than 10,000 and 1 =
CALCULATE(
COUNTROWS('cftc 10 %'),
'cftc 10 %'[ABSMTMDifferenceValue] > 10000,
'cftc 10 %'[age] = "1"
)

This approach correctly counts the rows per AssetClass that meet your both criteria.

 

muhammad_786_1_0-1724288831285.png

 

My suggestion: It's better to avoid spaces in table and column names to keep your DAX formulas cleaner and more readable.

 

Best Regards,
Muhammad Yousaf

 

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

 

Follow on LinkedIn

View solution in original post

4 REPLIES 4
sevenhills
Super User
Super User

Try with ALLSELECTED in place of ALL and see if it works!

No, it did not work.

I hope it'll work for you.

 

MTM Greater than 10,000 and 1 =
CALCULATE(
COUNTROWS('cftc 10 %'),
'cftc 10 %'[ABSMTMDifferenceValue] > 10000,
'cftc 10 %'[age] = "1"
)

This approach correctly counts the rows per AssetClass that meet your both criteria.

 

muhammad_786_1_0-1724288831285.png

 

My suggestion: It's better to avoid spaces in table and column names to keep your DAX formulas cleaner and more readable.

 

Best Regards,
Muhammad Yousaf

 

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

 

Follow on LinkedIn

This worked for me, thank you.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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