Home Forums Power Pivot Finding the MAXX value problem

This topic contains 2 replies, has 2 voices, and was last updated by  Avi Singh 8 years, 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3687

    Avi Singh
    Participant
    • Started: 5
    • Replies: 7
    • Total: 12

    I am trying to find the maximum number of products with a specific color;

    [Max Number of Product Color] := MAXX ( VALUES (Product[Color]), COUNTROWS(Product))  does not work. Gives the number of all products

    [Max Number of Product Color] := MAXX ( VALUES (Product[Color]), CALCULATE(COUNTROWS(Product))) Does work

    The question is why?

     

    #3689

    austinsense
    Participant
    • Started: 0
    • Replies: 2
    • Total: 2

    Using an aggregator formula like COUNTROWS (or SUM, MAX, AVG, etc) destroys the row context.  So MAXX is iterating through every row and the CALCULATE in the expression forces the COUNTROWS to look at that row individually.

    #3690

    Avi Singh
    Participant
    • Started: 5
    • Replies: 7
    • Total: 12

    Thanks austinsense. I was confused as I didn’t understand that aggregators had row context (which 20/20 hindsight now sounds logical). I knew that calculate turned row into filter context. Not likely to forget this one.

Viewing 3 posts - 1 through 3 (of 3 total)

The forum ‘Power Pivot’ is closed to new topics and replies.