Forum Discussion

LuisaCruz20's avatar
LuisaCruz20
New Member
8 years ago

Measure with Switch function with calculated percentage

I have a report for a Flower Company with 5 tables for data which are Finalcial, Budget, Sales 2017, Sales 2018 and Dispatches, these are conected to some translators for the codes of the sistem for: Customer, Flowers type and colors, Dates per period and Weeks and Type of Product. I have the following problem:

 

On the budget and Financial there is a color we call "assorted" and we usw it for some bouquets we sell that does not require an specific color. However, on the dispatch data we do not have assorted colors, there we have the real colors. My problem is, when I compare the budget with the sales I have a big difference between the colors and the assorted. I though with switch function in  measure it will be possible but, I could not use the "assorted" as value because it had to be a number. I need to conver the assorted like this below:

 

ALSTROEMERIA
Assorted 100% -158 K

COLOR %
Cherry 13% -20,532
Green 1% -1,579
Lavender 4% -6,318
Magenta 3% -4,738
Orange 13% -20,532
Pink 14% -22,112
Purple 10% -15,794
Red 16% -25,271
White 15% -23,691
Yellow 11% -17,374
-
100% -157,941


POMS
Assorted 100% -158 K

COLOR %
White 37% -58,438
Yellow 28% -44,223
Magenta 13% -20,532
Green 12% -18,953
Lavender 6% -9,476
Purple 3% -4,738
Cream 1% -1,579
100% -157,941

2 Replies

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Microsoft Employee

    Hi LuisaCruz20,

     

    From current description, I am not clear about what you were attempting to achieve. What is the source table? Could you provide some dummy data to show table structure and the relationship between tables? What is your desired result? Please illustrate with screenshot. How to Get Your Question Answered Quickly

     

    Regards,

    Yuliana Gu

     

     

    • LuisaCruz20's avatar
      LuisaCruz20
      New Member

      Yuliana, 

       

      Please see below the tables:

       

      Data:

      1. Budget:

       

      DATEComponent No.STEMSLocation CodeCustomer Label Box CodeProduction LocationFarm Production DateShipment Date
      02/28/2018FALST0633.164,00NJA13JF04/03/201804/10/2018
      02/27/2018FALST0643.164,00NJA13JF04/03/201804/10/2018
      02/27/2018FALST0652.712,00NJA13JF04/03/201804/10/2018
      02/27/2018FALST0662.712,00NJA13JF04/03/201804/10/2018
      02/27/2018FALST067904NJA13JF04/03/201804/10/2018
      02/27/2018FALST068552NJA13JF04/03/201804/10/2018
      02/27/2018FALST001276NJA13JF04/03/201804/10/2018
      02/27/2018FALST036552NJA13JF04/03/201804/10/2018
      02/27/2018FALST002414NJA13JF04/03/201804/10/2018
      02/27/2018FALST097276NJA13JF04/03/201804/10/2018
      02/27/2018FALST098552NJA13JF04/03/201804/10/2018
      02/27/2018FALST031414NJA13JF04/03/201804/10/2018
      02/27/2018FALST316414NJA13JF04/03/201804/10/2018
      02/27/2018FALST003414NJA13JF04/03/201804/10/2018
      02/27/2018FALST235414NJA13JF04/03/201804/10/2018
      03/02/2018FALST292276NJA13JF04/03/201804/10/2018
      04/09/2018FALST004414NJA13JF04/03/201804/10/2018
      04/09/2018FALST09960NJA13JF04/03/201804/10/2018
      04/09/2018FALST10040NJA13JF04/03/201804/10/2018

       

       2.  Actual Sales 

       

      DATEComponent No.STEMSLocation CodeCustomer Label Box CodeProduction LocationFarm Production DateShipment Date
      02/28/2018FALST0631608NJFF01JF02/25/201803/03/2018
      02/27/2018FALST0641608NJFF01JF02/24/201803/02/2018
      02/27/2018FALST0651608NJFF01JF02/24/201803/02/2018
      02/27/2018FALST0661608NJFF01JF02/24/201803/02/2018
      02/27/2018FALST0671608NJFF01JF02/24/201803/02/2018
      02/27/2018FALST0681950NJFF01JF02/24/201803/02/2018
      02/27/2018FALST001585NJFF01JF02/24/201803/02/2018
      02/27/2018FALST036585NJFF01JF02/24/201803/02/2018
      02/27/2018FALST0021170NJFF01JF02/24/201803/02/2018
      02/27/2018FALST0971170NJFF01JF02/24/201803/02/2018
      02/27/2018FALST098360NJFF01JF02/24/201803/02/2018
      02/27/2018FALST031216NJFF01JF02/24/201803/02/2018
      02/27/2018FALST316288NJFF01JF02/24/201803/02/2018
      02/27/2018FALST003216NJFF01JF02/24/201803/02/2018
      02/27/2018FALST235144NJFF01JF02/24/201803/02/2018
      03/02/2018FALST292288NJFF01JF02/27/201803/05/2018
      04/09/2018FALST004216NJFF01JF04/06/201804/12/2018
      04/09/2018FALST099216NJFF01JF04/06/201804/12/2018
      04/09/2018FALST1001734NJFF01JF04/06/201804/12/2018

       

       

      5. Real Dispatch:

       

      DATEComponent No.STEMSLocation CodeCustomer Label Box CodeProduction LocationFarm Production DateShipment Date
      02/28/2018FALST0631704NJFF01JF02/25/201803/03/2018
      02/27/2018FALST0641278NJFF01JF02/24/201803/02/2018
      02/27/2018FALST0651278NJFF01JF02/24/201803/02/2018
      02/27/2018FALST0661136NJFF01JF02/24/201803/02/2018
      02/27/2018FALST067852NJFF01JF02/24/201803/02/2018
      02/27/2018FALST068852NJFF01JF02/24/201803/02/2018
      02/27/2018FALST036852NJFF01JF02/24/201803/02/2018
      02/27/2018FALST002852NJFF01JF02/24/201803/02/2018
      02/27/2018FALST097852NJFF01JF02/24/201803/02/2018
      02/27/2018FALST064852NJFF01JF02/24/201803/02/2018
      02/27/2018FALST065852NJFF01JF02/24/201803/02/2018
      02/27/2018FALST064568NJFF01JF02/24/201803/02/2018
      02/27/2018FALST065568NJFF01JF02/24/201803/02/2018
      02/27/2018FALST068568NJFF01JF02/24/201803/02/2018
      02/27/2018FALST068568NJFF01JF02/24/201803/02/2018
      03/02/2018FALST036426NJFF01JF02/27/201803/05/2018
      04/09/2018FALST004426NJFF01JF04/06/201804/12/2018
      04/09/2018FALST099426NJFF01JF04/06/201804/12/2018
      04/09/2018FALST100426NJFF01JF04/06/201804/12/2018

       

      Connector:

       

      No_DescriptionTypeColorCategoryBase Color
      FALST063ALSTRO - 5 ST - HOT PINKALSTROHOT PINKPRIMARYHOT PINK
      FALST064ALSTRO - 5 ST - ORANGEALSTROORANGEPRIMARYORANGE
      FALST065ALSTRO - 5 ST - PINKALSTROPINKPRIMARYPINK
      FALST066ALSTRO - 5 ST - PURPLEALSTROPURPLEPRIMARYPURPLE
      FALST067ALSTRO - 5 ST - REDALSTROREDPRIMARYRED
      FALST068ALSTRO - 5 ST - YELLOWALSTROYELLOWPRIMARYYELLOW
      FALST001ALSTRO FANCY ASSORTALSTROASSORTPRIMARYASSORT
      FALST036ALSTRO FANCY BURGUNDYALSTROBURGUNDYPRIMARYBURGUNDY
      FALST002ALSTRO FANCY CHARMALSTROCHARMPRIMARYCHARM
      FALST097ALSTRO FANCY CHERRYALSTROCHERRYPRIMARYHOT PINK
      FALST098ALSTRO FANCY CORALALSTROCORALPRIMARYCORAL
      FALST031ALSTRO FANCY FALL PACKALSTROFALL PACKPRIMARYASSORT
      FALST316ALSTRO FANCY GREEN SHAKIRAALSTROGREEN SHAKIRAPRIMARYGREEN
      FALST003ALSTRO FANCY HOT PINKALSTROHOT PINKPRIMARYHOT PINK
      FALST235ALSTRO FANCY HOT PINK PTD ORANALSTROHOT PINK PTD ORANGEPRIMARYHOT PINK
      FALST292ALSTRO FANCY HOT PINK PTD PINKALSTROHOT PINK PTD PINKPRIMARYHOT PINK
      FALST004ALSTRO FANCY LAVENDERALSTROLAVENDERPRIMARYLAVENDER
      FALST099ALSTRO FANCY MAGENTAALSTROMAGENTAPRIMARYMAGENTA
      FALST100ALSTRO FANCY MAGENTA LIGHTALSTROMAGENTA LIGHTPRIMARYMAGENTA

       

      When you port the tables to Power Bi and you conecthem and create a grafic to compare the stems by color,  you will se the Dispatch table does not have Assorted Color. What I need to do is to create a measure where I can divide the stems of assorted colors of the firts 4 tables to the other colors of Alstro in the percentages below:

       

      ALSTROEMERIA  
       Assorted100%-                184K
          
       COLOR% 
      ALSTROHOT PINK13%-                24 K
      ALSTROGREEN1%-                  2 K
      ALSTROLAVENDER4%-                  7 K
      ALSTROMAGENTA3%-                  6 K
      ALSTROORANGE13%-                24 K
      ALSTROPINK14%-                26 K
      ALSTROPURPLE10%-                18 K
      ALSTRORED16%-                29 K
      ALSTROWHITE15%-                28 K
      ALSTROYELLOW11%-                20 K
                           -
        Total100%-       184K

       

      these in order to compare the budget and other files with the real dispatch in the same portion. I tried with Switch function but it only accepts numerical values as the reference; if you can help me, I will appreciate it!!!