Forum Discussion

Stel's avatar
Stel
Icon for Helper I rankHelper I
6 years ago

Maxx value returns sum instead of max value

 

Hi,

 

I want to show the max number of movements per hour in a card in the right upper corner.

As you can see, I currently get the value 377 as a result. This is fault because it's the sum of the Max values. 

Below in the table, the last column "max (per uur)" shows the max values. So in this case I want to show 79 as max value instead of 377.

 

I've tried with the following measures:

 

max_movements_per_hour =
MAXX (
SUMMARIZE(fact_location_inventory_transaction;dim_time[time_hour24];
"total";
COUNTROWS(fact_location_inventory_transaction));
[total]
)
 
And a second attempt:
max_movements_per_hour_v2 = MAXX(KEEPFILTERS(VALUES(dim_time[time_hour24])); [sum_movements])
 
But both gave the 377 as value instad of 79.
 

 

Can someone help me with this?

Thanks

3 Replies

  • Stel 

    The use of Summarize and count and max means count till this level(dim_time[time_hour24]) and then take max.

    is this correct row context dim_time[time_hour24] ?

    • Stel's avatar
      Stel
      Icon for Helper I rankHelper I

      amitchandak , I want the max movements per hour. The dim_time is a time table and the column [time_hour24] represents the hours in 24 format. Meaning 1, 2 ...24

      So I would like to count all the rows of the fact_location_inventory_transaction in an hour. So number of rows with same value in time_hour24. And take the max of all the values calculated. Independent of from/to date selection.

       

      For some reason at a certain point, I get the sum of the max values instead of max of max values.

       

      My dim_date table and dim_time table are separate tables, linked to the fact_location_inventory_transaction table. Could that have something to do with it?

       

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Stel,

    I'd like to suggest you take a look at the following blog about measure total, it should suitable for your scenario:

    Measure Totals, The Final Word 

    Regards,

    Xiaoxin Sheng