Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi All,
I am seeing an issue with a bar chart when I use a calculated measure that includes "Summarizecolumns()" . This measure is working fine with a card visual but when I use this on any other visual, it throws an error "SummarizeColumns() and AddMissingItems() may not be used in this context"
My requirements is as follows, there are 3 tables: DATE, LOCATION, TIMECARD SWIPES(transactional table that contains employee hours worked). I want to see the total count of employees who worked over 40 hours by the location for the selected time period slicer.
The following measure calculates the count of employees who worked over 40 hours. When I select a date slicer and use this measure in a card visual, it works fine but when used in a bar chart with location as axis, it throws error.
Can somebody tell me where am I going wrong? I have attached the workook and screenshot below.
Solved! Go to Solution.
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:
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.
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]))))
here is the link to download the file.
https://drive.google.com/file/d/1v9zeFsyJ6ovTKpF8OEZ-tzWRquH_5NMa/view?usp=sharing
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:
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.
yes, this works.
Thanks much.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
98 | |
78 | |
65 | |
53 |
User | Count |
---|---|
144 | |
103 | |
98 | |
85 | |
64 |