Forum Discussion

TaariqHussain's avatar
3 years ago

Grouping data for a visual

 

I have 2 tables items sales and a second that has item cost

both linked to master inventory table

I have a measure that calculates my GP% however i want to group my GP's as per below

 

thats where this formula i found on the forum comes in

Measure =
VAR __Date = MAX('ItemWiseSales'[dateinvoiced])
VAR __Category = MAX('Category'[Category])
VAR __Low =
SWITCH(
    __Category,
    "Less than 1%",-0.2,
    "1%",0.01,
    "2%",0.02,
    "3-5%",0.03,
    "5%>",0.05
)
VAR __High =
SWITCH(
    __Category,
"Less than 1%",0.01,
    "1%",0.019,
    "2%",0.029,
    "3-5%",0.049,
    "5%>",0.2
)
VAR __tmpTable = SUMMARIZE('ItemWiseSales',ItemWiseSales[itemprice],"__Percent",[GP%])
RETURN COUNTROWS(FILTER(__tmpTable,[__Percent]>=__Low && [__Percent]<=__High))
 
i than pull that measure into a pie chart but the visual is completely off

 

Please assist on a fix or possible alternative

original formula from a reply by Greg_Deckler on different post

2 Replies

    • TaariqHussain's avatar
      TaariqHussain
      Helper I

      Good day

       

      Thank you for your response

       

      As per above this a sample of a visual i want to see

      With that i also want to drill down each slice to see the items in that GP% range

      below is my 3 sample data sources

      Item sales

       

      BarcodeProduct DescriptionUnit Price
      FRBR8FRANGOSA BRAAI PACK 8X800G FZN36.9
      3C5CHUBBY CHICK IQF 3X5KG29.75
      C26CHUBBY 6X2KG IQF29.8
      RHFRainbow Head And Feet 10x1kg12.5
      DCD10DS - FRESH DRUMSTICK 10Kg45.5
      3R5MPRB IQF MIX PORTIONS 3X5KG30.5
         

       

      Last GRV Cost

      Item CodeItem DescriptionLast Invoice Cost
      3C5CHUBBY CHICK IQF 3X5KG28.03
      3R5MPRB IQF MIX PORTIONS 3X5KG32.87
      C26CHUBBY 6X2KG IQF28.03
      DCD10DS - FRESH DRUMSTICK 10Kg44
      FRBR8FRANGOSA BRAAI PACK 8X800G FZN28.5
      RHFRainbow Head And Feet 10x1kg9.98

       

      Master stock data

      Item CodeItem Description
      RHFRainbow Head And Feet 10x1kg
      3C5CHUBBY CHICK IQF 3X5KG
      C26CHUBBY 6X2KG IQF
      FRBR8FRANGOSA BRAAI PACK 8X800G FZN
      3R5MPRB IQF MIX PORTIONS 3X5KG
      DCD10DS - FRESH DRUMSTICK 10Kg

       

      Thank you