Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi,
I have a measure named "color" and I want to have a measure that count how many times I have "red" color or another color.
For example I have a table as below :
Car---------Zone-------- color--------------------Measure
A EU red 1
B EU blue 0
C EU red 1
Total 2
I want a measure which returns 2
I tried that but I doesn't work...
freq = CALCULATE(COUNTROWS(table),FILTER(table,[color]="red")))
Please if someone can help me,
Thank you
Solved! Go to Solution.
It seems that your "Trend_W" is a measure it self.
Try a maesure like below
freq = COUNTX(Values(table[Zone]), IF ( [Trend_W] = "#FF0000", 1))
_Freq New = SUMX(Values(Table[Car]),Freq)
Proud to be a Super User!
This should results your desired results. One thing that you can check if you have check "Show Items with No Data" to the CARS field in the table.
Else you can try below expression as well
freq = IF(ISBLANK(CALCULATE(COUNTROWS('Table'),FILTER('Table',[color]="red"))),0,CALCULATE(COUNTROWS('Table'),FILTER('Table',[color]="red")))
Proud to be a Super User!
Hi @FarhanAhmed , thank you for your answer, but I don't get the result that I want : I let you see
I must obtain 3 as a result and not 9.
you want to count Distinct Reds ? the freq measure results are fine though
Proud to be a Super User!
Yes I want to count only red color which hex color is "#FF0000". The freq measure result is false because I should obtain 3 and not 9
Try this measure instead
freq = IF(HASONEVALUE('Table'[Car]),
IF(ISBLANK(CALCULATE(COUNTROWS('Table'),FILTER('Table',[color]="red"))),0,CALCULATE(COUNTROWS('Table'),FILTER('Table',[color]="red"))),CALCULATE(DISTINCTCOUNT('Table'[Car]),FILTER('Table','Table'[Color]="Red")))
Proud to be a Super User!
I dont obtain the right result, maybe because [ car ] is not a column but a measure... I obtained the same result as previously.
With this measure I have the right filter but I don't know how to have a sum and a total :
It seems that your "Trend_W" is a measure it self.
Try a maesure like below
freq = COUNTX(Values(table[Zone]), IF ( [Trend_W] = "#FF0000", 1))
_Freq New = SUMX(Values(Table[Car]),Freq)
Proud to be a Super User!
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
90 | |
88 | |
83 | |
64 | |
49 |
User | Count |
---|---|
126 | |
110 | |
87 | |
70 | |
66 |