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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
donbonbon
Frequent Visitor

Something wrong with calculated column (using filtering in it)

Hey,

 

I cannot figure out what is wrong with this formula Column = calculate(DISTINCTCOUNT('DB'[lead_id],FILTER('DB', 'DB'[status]="accepted")))

 

Thnx!

1 ACCEPTED SOLUTION
muchinski
Resolver II
Resolver II

Please, try the following:

Column = calculate(DISTINCTCOUNT('DB'[lead_id]),'DB'[status]="accepted")

 

Explanation: The second part for the CALCULATE is already the filter expression. You don't need to use FILTER in this case. In addition, DISTINCTCOUNT accepts only 1 parameter, so you need to close your parenthesis right after 'DB'[lead_id].

EXTRA TIP: If you want this expression to consider also the other filters applied on you report, you can use the following:

Column = calculate(DISTINCTCOUNT('DB'[lead_id]),KEEPFILTERS('DB'[status]="accepted"))



View solution in original post

5 REPLIES 5
MattAllington
Community Champion
Community Champion

You will need to provide more information if you want help. Eg What are you expecting and what are you getting?



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

sorry, I didnt think it was relevant. It just highlights me it in red. I need to count distinct lead_id from table DB where status od this lead_id is accepted

 

 

muchinski
Resolver II
Resolver II

Please, try the following:

Column = calculate(DISTINCTCOUNT('DB'[lead_id]),'DB'[status]="accepted")

 

Explanation: The second part for the CALCULATE is already the filter expression. You don't need to use FILTER in this case. In addition, DISTINCTCOUNT accepts only 1 parameter, so you need to close your parenthesis right after 'DB'[lead_id].

EXTRA TIP: If you want this expression to consider also the other filters applied on you report, you can use the following:

Column = calculate(DISTINCTCOUNT('DB'[lead_id]),KEEPFILTERS('DB'[status]="accepted"))



it worked, thnx a lot!

there is no result, just an error. so I cant understand what is wrong with the sintaxis

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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