Forum Discussion
Counting a value in each column by week
Hello,
I have a column that says either pass or fail and I 'm tyring to do a countif to let me know how many pass or fails I have but I want to filter it by week. I have a similar DAX formula where using allexcept(table name, name column) worked but when I try it with again, it says that W12 it says "Cannot convert value 'W12' of type Text to type True/False."
Here is the formula that I was able to use to get a weekly value:
Here's what I have so far:
Thank you!
- Anonymous5 years ago
I did it in two ways, please try:
Measure = CALCULATE ( COUNT ( TableName[ColumnName] ), FILTER ( ALLEXCEPT ( TableName, TableName[Week] ), 'TableName'[ColumnName] = "Pass" ) ) + 0O
Measure 2 = CALCULATE ( COUNT ( TableName[ColumnName] ), FILTER ( ALL ( 'TableName' ), 'TableName'[ColumnName] = "Pass" && 'TableName'[Week] = MAX ( 'TableName'[Week] ) ) ) + 0The final output is shown below:
If this post helps, then consider Accept it as the solution to help other members find it faster.
Best regards
Eyelyn Qin
2 Replies
- Ashish_Mathur
Super User
Hi,
This is what you should do:
- Create a Calendar Table and extract Year, Month Name, Month number and week number is seperate columns using calculated column formulas
- Create a relationship from the Date column in your dataset to the Date column in your Calendar Table
- Create slicers for Year, Month Name and Week from the Calendar Table and select one entry in each slicer
- To your visual, drag "ColumnName" column
- Write this measure
Measure = countrows(data)
Hope this helps.
- AnonymousNot applicable
I did it in two ways, please try:
Measure = CALCULATE ( COUNT ( TableName[ColumnName] ), FILTER ( ALLEXCEPT ( TableName, TableName[Week] ), 'TableName'[ColumnName] = "Pass" ) ) + 0O
Measure 2 = CALCULATE ( COUNT ( TableName[ColumnName] ), FILTER ( ALL ( 'TableName' ), 'TableName'[ColumnName] = "Pass" && 'TableName'[Week] = MAX ( 'TableName'[Week] ) ) ) + 0The final output is shown below:
If this post helps, then consider Accept it as the solution to help other members find it faster.
Best regards
Eyelyn Qin