Forum Discussion
Power BI Count IF Like
- 7 years ago
MeasureCount = CALCULATE(COUNTROWS(Like);FILTER(Like;LEFT(Like[SamAccount];3)="DA_" && Like[enable]="TRUE"))
Best Regards,
Miguel
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Ok, I see two wrong things:
- Names. You must change my names for your names (table and columns).
- In your capture, your columns has no names. You must define the first row like a header.
Otherwise, I test the code and works fine. Give me your feedback and see it.
Ok so i have named the coloums and the table? and it is still the same error? could you show your example?
- ZunzunUOC7 years agoResolver III
MeasureCount = CALCULATE(COUNTROWS(Like);FILTER(Like;LEFT(Like[SamAccount];3)="DA_" && Like[enable]="TRUE"))
Best Regards,
Miguel
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. - ZunzunUOC7 years agoResolver III
Could you change ";" per ","?
- Anonymous7 years agoNot applicable
So that seems to of fixed the ; issue. However it doesn't seem to allow me to count the enabled accounts?
- ZunzunUOC7 years agoResolver III
Have you create a calculated column?
- Anonymous7 years agoNot applicable
Ok i see now it works. However, that is not what i was looking for? I wanted to be able to add a measure so i can show it on a dashboard. I want to be able to Count all accounts which start with DA_ and in the enabled coloum are True. so if there are 30 accounts and only 10 are enabled it will show 10 not 30.
- ZunzunUOC7 years agoResolver III
Ok, try with this:
MeasureCount = CALCULATE(COUNTROWS(Like);FILTER(Like;Like[enable]="TRUE"))
- Anonymous7 years agoNot applicable
But i only want to count it if it has DA_ in SamAccount?
- ZunzunUOC7 years agoResolver III
Then, change the code to:
MeasureCount = CALCULATE(COUNTROWS(Like);FILTER(Like;LEFT(Like[SamAccount];3)="DA_"))
- Anonymous7 years agoNot applicable
But that doesnt do both so i need to count the enabled accounts that match DA_?
- Anonymous7 years agoNot applicable
Thank you :)
- v-chuncz-msft7 years agoCommunity Support
Anonymous
By the way, you may help accept the solution above. Your contribution is highly appreciated.