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
AliceW
Impactful Individual
Impactful Individual

A simple CALCULATE formula to be influenced by its filter twice?

Hi fellow Power BI enthusiasts,

I have the feeling this is an easy one, but for the life of me I can't figure it out.

We have this super simple formula that works:

Opp Count = CALCULATE(DISTINCTCOUNT([Opp ID]),[Amount] > 0).

The result is nicely displayed in a Card.

However, I created an Amount filter in the right-side filter panel. Which, to my changrin, doesn't work on the Card.

The goal is for the user to be able to select all Opps with an Amount of, say, under 1000.

How can I fix this, please? I really need the Amount filter...

Thank you in advance,

Alice

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@AliceW , Try

countx(filter(values(Table[Opp ID]),[Amount] > 0),[Opp ID])

View solution in original post

Opp Count =
CALCULATE ( DISTINCTCOUNT ( Table[Opp ID] ), KEEPFILTERS ( Table[Amount] > 0 ) )

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

@AliceW , Try

countx(filter(values(Table[Opp ID]),[Amount] > 0),[Opp ID])
AliceW
Impactful Individual
Impactful Individual

Thank  you, Amit!!

AliceW
Impactful Individual
Impactful Individual

I came up with a solution, but if anyone has a more elegant one, I'm all ears.

Mine was to simply copy the Amount column in the dataset, rename it something similar (Amount Totals), and use this copy as a filter. It actually works!

Opp Count =
CALCULATE ( DISTINCTCOUNT ( Table[Opp ID] ), KEEPFILTERS ( Table[Amount] > 0 ) )

Thank you so much, Antriksh!!

Amazing, you're welcome!!

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.