Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Issue with Bar chart: SummarizeColumns() and AddMissingItems() may not be used in this context

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...
  • mahoneypat's avatar
    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 ) ) + 0
     

    If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat