Forum Discussion
Issue with Bar chart: SummarizeColumns() and AddMissingItems() may not be used in this context
- 6 years ago
It's probably becuase the Location column is in both the visual and the SUMMARIZECOLUMNS(). When SUMMARIZECOLUMNS() throws an error, I sometimes use its less error prone predecessor ADDCOLUMNS(SUMMARIZE(). Here is that version of your measure:
Count_Over40 =
VAR tablex =
FILTER (
ADDCOLUMNS (
SUMMARIZE (
'Timecard Swipes',
'Date'[WeekNum_Year],
'Timecard Swipes'[Employee_ID],
'Timecard Swipes'[Location]
),
"XXHours", CALCULATE ( SUM ( 'Timecard Swipes'[Work_Hours] ) )
),
[XXHours] > 40
)
RETURN
CALCULATE ( COUNTROWS ( tablex ) ) + 0If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
I have a similar issue. I have a list of companies. The companies have products categorized by product code. What I'm trying to do is select a company (or multiple) in a slicer and see the count of products that other companies have in the same product code as the selected company (or multiple). The below DAX works great for that in a simple card, but if I use it in a barchart for example so I can visualize the count by product code, then I get the error SummarizeColumns() and AddMissingItems() may not be used in this context. Please help!
Measure =
CALCULATE(
DISTINCTCOUNT('TableA'[productid]),
SUMMARIZECOLUMNS('TableA'[product_code],
FILTER('TableA','TableA'[company_name] IN VALUES('TableB'[company_name]))))