Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello, i have a database just like this one in Excel
In this situation i can use COUNTIF in the OrderId column, but in power bi i cant figure out how to translate this to a calculate funtion or even in M language, is there any way to do something like this "CountIf column"?
Thanks
PowerBI File
Solved! Go to Solution.
Hi @Anonymous ,
According to my understanding, you want to calculate the count per OrderID, right?
You could use the following formula:
CountPerOrderId =
CALCULATE ( COUNTROWS ( 'CountIf' ), ALLEXCEPT ( CountIf, CountIf[OrderId] ) )My visualization looks like this:
For more useful information ,you could refer to: https://goodly.co.in/countif-power-bi-dax/
Is the result what you want? If you have any questions, please upload some data samples and expected output.
Please do mask sensitive data before uploading.
Best Regards,
Eyelyn Qin
Hi @Anonymous ,
According to my understanding, you want to calculate the count per OrderID, right?
You could use the following formula:
CountPerOrderId =
CALCULATE ( COUNTROWS ( 'CountIf' ), ALLEXCEPT ( CountIf, CountIf[OrderId] ) )My visualization looks like this:
For more useful information ,you could refer to: https://goodly.co.in/countif-power-bi-dax/
Is the result what you want? If you have any questions, please upload some data samples and expected output.
Please do mask sensitive data before uploading.
Best Regards,
Eyelyn Qin
You can use this expression in a measure to get the count of rows with the same OrderID
Count Same ID = CALCULATE(COUNTROWS(Table), ALLEXCEPT(Table, Table[OrderId]))
Use it in a table visual with the OrderId column. Replace Table with the actual table name.
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
@Anonymous - According to Excel to DAX Translation: https://community.powerbi.com/t5/Community-Blog/Excel-to-DAX-Translation/ba-p/1060991
COUNTIF is here: https://community.powerbi.com/t5/Community-Blog/CO-CU-Excel-to-DAX-Translation/ba-p/1080018#M2077
And is:
COUNTX(FILTER(...)...) or CALCULATE(COUNT(),FILTER(...))
Can you give me an example of what you want the conditions to be?
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!