Forum Discussion
COUNTIFS in Power BI
Hello all,
Hoping someone can help. I'm trying to recreate the below excel formula in Power BI
=COUNTIFS(G:G,"<="&H:H,AL:AL,"")
I've tried combinations of
Count = COUNTROWS(FILTER(
I've referred to my field names rather than the column letter etc but still can't get it to work. How can I do he formula above but of course subsitute column names for the fields.
Thanks
Hi Dan27,
Based on this sample data, is 3 the desired result? If so, please new a measure and add it to card visual.
Measure1 = CALCULATE(COUNTROWS(Table2),FILTER(Table2,Table2[G]<=Table2[H]))
For more advice, please illustrate your requirement with actual sample data and desired result rather than just the Excel functions.
Regards,
Yuliana Gu
8 Replies
- Greg_Deckler
Community Champion
COUNTIFS in Excel are generally replaced by using CALCULATE.
- Dan27Regular Visitor
Thanks Greg but in what format?
If I use FieldName = CALCULATE([Field1] <= [Field2], " ") for example then I get a message saying the maximum argument count is 2.
Appreciated. Thanks.
- AnonymousNot applicable
Hereis the example.
CALCULATE ( COUNT(Table1[Column1]), FILTER ( Table1, Table1[column1] < Table1[Clumn2]))
Thanks
Raj
- v-yulgu-msft
Microsoft Employee
Hi Dan27,
Based on this sample data, is 3 the desired result? If so, please new a measure and add it to card visual.
Measure1 = CALCULATE(COUNTROWS(Table2),FILTER(Table2,Table2[G]<=Table2[H]))
For more advice, please illustrate your requirement with actual sample data and desired result rather than just the Excel functions.
Regards,
Yuliana Gu
- NataliGNew Member
Hi,
I've gone through many posts on this topic and unfortunately nothing seems to work. Maybe my knowledge of DAX is limited and i'm not able to customise the solutions as per my needs so eager to receive any help.
I'm trying to identify duplicate booking of purchase invoices in my dataset which is something like the table below. I need to be able to use a countifs like functionality to check for rows where invoice no# and transaction amount are the same. so in excel i would have added a column after D with the following formula :COUNTIFS(C:C,C2,D:D,D2). And then i could proceed to evaluate any rows that returned a value greater than 1. I have not been able to achieve this yet in power bi. any help is greatly appreciated.
A B C D Vendor ID.# Name Invoice No.# Transaction Amount 600754 aaaa 123 366 989111 bbbb 234 320 242001 cccc 86030 242 600754 aaaa 123 366