Forum Discussion

Justas4478's avatar
Justas4478
Icon for Post Prodigy rankPost Prodigy
2 years ago

Creating group by measure using existing measure

Hi, I have this measure which count shorted qty and gives number of days item was shorted.

Days Shorted = VAR _Table =
    SUMMARIZE(
         'Outbound Delivery',
         'Product Category'[Level 2],
         'Date'[Date],
         "@Shorted", 'Outbound Delivery'[Shorted Qty]
    )
VAR _Result =
    COUNTX(
        FILTER(
             _Table,
              [@Shorted] <> 0
        ),
        [@Shorted]
    )
RETURN
  _Result 
Problem is that withou further grouping this data is not that usefull.
I would be abel to do it if it were calculated column.
But unfortunatelly for me we are using live connection model, so I can only create measures.
This is sample of the data that I have:

And I trying to group 'Days Shorted' into six groups. These are the groups:

And this is expected result based on sample data:

I attached sample data.
https://we.tl/t-fT2YKclDaE 

If there is need for larger data sample I can provide it.

1 Reply

  • Hi Justas4478 ,

     

    since you are in live connection you need to create a measure for each of your calculation try to add a measure for each of your calculations:

     

    1 days = 
            VAR temp_table = SUMMARIZE(
    			'Outbound Delivery',
    			'Outbound Delivery'[Gate/Floor],
    			'Outbound Delivery'[SKU Number],
    			"Days", [Days Shorted]
    		)
    		RETURN
    
    			COUNTROWS(FILTER(
    				temp_table,
    				[Days] = 1
    			)
    
    			)

     Just replace the 1 by the number of days you need and then on the matrix visualization put values on rows: