Forum Discussion
Countif in powerbi
- 7 years ago
Your first issue is the shape of your data. The data engine for Power BI is Power Pivot. This is a column-based database, essentially. So, you would first need to "un-pivot" your data via Power Query ("Get Data" in power BI) so that you would go from having a 13 column table to a three column table with Part number, month, and value.
Once you've done that, you could write a dax measure to do the count for you. Here I'll need to defer to some dax ninjas in the group. But it would likely involve a variable that would countrows on a dax query, then wrapping a count function in a calculate with that variable equals 1. If I can find an example of the formula, i'll update this post.
Your first issue is the shape of your data. The data engine for Power BI is Power Pivot. This is a column-based database, essentially. So, you would first need to "un-pivot" your data via Power Query ("Get Data" in power BI) so that you would go from having a 13 column table to a three column table with Part number, month, and value.
Once you've done that, you could write a dax measure to do the count for you. Here I'll need to defer to some dax ninjas in the group. But it would likely involve a variable that would countrows on a dax query, then wrapping a count function in a calculate with that variable equals 1. If I can find an example of the formula, i'll update this post.