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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
WLFRD
Helper III
Helper III

SUM values filtered by another column

Hello,

 

I have been using Power BI for some time but I now run into an issue I don't know how to solve yet.

 

So I have a table like this:

CodeOHNOH
12510
12510
12510
12510
12501
12501
12610
12610
12601
12710
12710
12710
12710
12801
12801

 

And I would like to count the OH 1's and NOH 1's per code. The end result would look like this:

CodeOHNOH
12542
12621
12740
12802

 

I have tried several DAX functions and some standard options which Power BI has. Up until now, I was not able to get the result I would like to see.

 

Maybe someone can help me out with this issue.

 

Thanks in advance.

 

Regards,

Wilfred

1 ACCEPTED SOLUTION
aj1973
Community Champion
Community Champion

Count OH=

Hi @WLFRD 

VAR _Code = SELECTEDVALUE(TABLE[CODE])

VAR _RESULT = CALCULATE(COUNT(TABLE[OH]), TABLE[CODE] = _Code)

RETURN

_RESULT

 

do the same for NOH

But i think you want to see the SUM and not the COUNT. if so replace Count by SUM.

 

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

View solution in original post

4 REPLIES 4
WLFRD
Helper III
Helper III

For some reason the provided possible solution didn't solve the problem. What I've done is, use the standard Count and Distinct Count option in Power BI. 

aj1973
Community Champion
Community Champion

Did you use SUM instead?

Can you share your file?

Is your porblem solved?

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

aj1973
Community Champion
Community Champion

If all good please mark the thread as solved for the rest of the community.

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

aj1973
Community Champion
Community Champion

Count OH=

Hi @WLFRD 

VAR _Code = SELECTEDVALUE(TABLE[CODE])

VAR _RESULT = CALCULATE(COUNT(TABLE[OH]), TABLE[CODE] = _Code)

RETURN

_RESULT

 

do the same for NOH

But i think you want to see the SUM and not the COUNT. if so replace Count by SUM.

 

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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