cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
hugors
Regular Visitor

Filter or virtual table

I have a measure where I calculate a percentage, I need to count the records that have a percentage greater than or equal to 80 but

I can't do this filter and count all the measures that I try do not return the items as if I didn't identify which ones have this value.

 

vM80 =
CALCULATE(
DISTINCTCOUNT([CO_MUNICIPIO]),
FILTER(F_Dados,F_Dados[c_CV Geral]>=80)
)
 
 
 
print.png
2 ACCEPTED SOLUTIONS
SpartaBI
Community Champion
Community Champion

Don't have enough info about your model, but just by looking at your measure, try to replace it with:

vM80 =
CALCULATE(
DISTINCTCOUNT([CO_MUNICIPIO]),
F_Dados[c_CV Geral]>=80)
)

 
it as if you will write:

 
vM80 =
CALCULATE(
DISTINCTCOUNT([CO_MUNICIPIO]),
FILTER(ALL(F_Dados[c_CV Geral]),F_Dados[c_CV Geral]>=80)
)
which is different substentially than what you wrote so maybe it will solve your problem quickly 

View solution in original post

I tried it before but it didn't work

View solution in original post

13 REPLIES 13
hugors
Regular Visitor

Good afternoon, I managed to solve it was a relationship problem between the dimensions

hugors
Regular Visitor

I managed to solve it, THANK YOU ALL

v-yangliu-msft
Community Support
Community Support

Hi  @hugors ,

I created some data:

vyangliumsft_0-1650955481305.png

Here are the steps you can follow:

1. Create measure.

Flag =
IF(
    [CV %] >=80,1,0)
discount =
CALCULATE(DISTINCTCOUNT(F_Dados[ID]),ALLSELECTED('F_Dados'))

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_1-1650955481306.png

3. Result:

vyangliumsft_2-1650955481307.png

If I have misunderstood your meaning, please provide your pbix file without privacy information and desired output.

 

Best Regards,

Liu Yang

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

The solution is interesting but it didn't work either, I'm believing that it may be an association problem between the models. I keep trying, thanks for the help

PaulDBrown
Community Champion
Community Champion

Try:

vM80 =
CALCULATE ( DISTINCTCOUNT ( 'Table'[CO_MUNICIPIO] ), FILTER ( F_Dados, [CV %] >= 80 ) )

Change 'Table' to whatever table the [CO_MUNICIPIO] is in





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






I tried it before but it didn't work

Thanks for the answer, but in the count it returns the total of rows as a result and not just the rows that have the "CV %" greater than or equal to 80

SpartaBI
Community Champion
Community Champion

Don't have enough info about your model, but just by looking at your measure, try to replace it with:

vM80 =
CALCULATE(
DISTINCTCOUNT([CO_MUNICIPIO]),
F_Dados[c_CV Geral]>=80)
)

 
it as if you will write:

 
vM80 =
CALCULATE(
DISTINCTCOUNT([CO_MUNICIPIO]),
FILTER(ALL(F_Dados[c_CV Geral]),F_Dados[c_CV Geral]>=80)
)
which is different substentially than what you wrote so maybe it will solve your problem quickly 

A 'PLACEHOLDER' function was used in a True/False expression used as a table filter expression. This is not allowed.

SpartaBI
Community Champion
Community Champion

Yes, because it's a measure. Your code had a table name before that, which indicates that its a column :).

It won't work in the way I wrote it if "c_CV Geral is a measure .

In this case I do need more info about your model. Can you share the file?

Yes, it is a measure I can forward the file, do you have an email

Hi,

Share the download link of your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks for the answer, but, when trying to use the measure as proposed, it returns the message "It is not possible to find the column 'c_CV Geral' in the table 'F_Dados' or it is not allowed to use it in this expression" only reinforcing the column "c_CV Geral" is a calculated measure, I changed the column "c_CV Geral" for a fixed one, but it always returns 1 for all rows

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors