Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

Measure that groups sales

Hello people!

 

I'm needing a bit of help.

 

I'm trying to make a mesaure that groups sales by the first 3 letters of a description.

 

In my fact table I have sales open by IdZonaGestion (examples: "ARG-OTR", "ARG-ROE", etc). The sum of all sales of a specific period represents market sales, while the sales of same period but only of those IdZonaGestion wich last 3 letters are not "OTR" represents my sales.

 

So, in my scenario, I need to perform a report thats opened by IdZonaGestion showing only my sales (all the IdZonaGestion that not finish in "OTR") and with a column that has a mesaure that displays the participation of my sales in the market.

 

The sales of market are by country, so, in these case the SUM of sales of the IdZonaGestion that starts with "ARG" (Argentina) are the market sakles, and the SUM of sales of the IdZonaGestion that do not finish in "OTR" are my sales.

 

What I have done so far, is this:

 

And some data sample:

IDIdPeriodoIdAnioIdMesIdPaisPresentacionCorporacionLaboratorioIdCompaniaIdClaseTerapeutica1IdClaseTerapeutica2IdClaseTerapeutica3IdClaseTerapeutica4MercadoMercadoPorTipoIdMarcaMarcaSubFamiliaAnioLanzamientoConcentracionFechaLanzamientoMATUnidadesSalidasImporteVendidoImporteVendidoUSDIdPaisIMSGrupoIdZonaGestion
120120220122ARG       3-tc Tabl Recubie 150 Mg X 60Glaxosmithkli.corpGlaxosmithkline PhARG-OTRJJ05J05CJ05C1EticoMarca10523-tcLamivudine1996150 MG[Legacy Products]93885,29992894,24063ArgentinaGLAXOSMITHKLI CORPARG-OTR
220120220122ARG       5 Asa Sobres 2 G X 30DominguezDominguezARG-OTRAA07A07EA07E1EticoMarca10535 AsaMesalazine20162 G[Legacy Products]000ArgentinaDOMINGUEZARG-OTR
320120220122ARG       8-horas Tabl Recubie 1 Mg X 30Elea CorpEleaARG-OTRNN05N05BN05B1EticoMarca93318-horasEszopiclone20071 MG[Legacy Products]44812902,40392969,61728ArgentinaELEA CORPARG-OTR
420120220122ARG       A Sun Fluide 50+ Envase 40 Ml X 1DispolabDispolabARG-OTRDD02D02AD02A0PopularMarca17041A Sun Fluide 50+Ectoin + Titanium + Vitamin E2013[N/A]Launched in MAT Ene.-14000ArgentinaDISPOLABARG-OTR
520120220122ARG       A-acido Emoliente Crema 25 Mg 30 G X 1DominguezDominguezARG-OTRDD05D05XD05X0EticoMarca1058A-acido EmolienteTretinoin199325 MG[Legacy Products]312219,28941510,79165ArgentinaDOMINGUEZARG-OTR
620120220122ARG       A-derma Exomega Leche 400 Ml X 1Pierre FabrePierre Fabre DermoARG-OTRDD02D02AD02A0PopularMarca37981A-derma ExomegaAvena Sativa + Butyrospermum Parkii + Glycerol2009[N/A][Legacy Products]50138592,01968882,33922ArgentinaPIERRE FABREARG-OTR
720120220122ARG       A-vitel Pant Solar Crema Fps36 120 G X 1MedipharmaMedipharmaARG-OTRDD02D02AD02A0PopularMarca14293A-vitel Pant SolarRetinol2003[N/A][Legacy Products]123,87999655,49622ArgentinaMEDIPHARMAARG-OTR

 

What I guess, is that I need to group the sales in measure "Ventas USD IMS Mercado", so all the IdZonaGestion that start with same first 3 letters have same value. This, with the porpuse of making later a mesaure for the participation.

 

Resuming, I imagine that in the table that I share, I would have "IdZonaGestion", "Ventas USD IMS Propio" (my sales), and "Ventas USD IMS Mercado" (sum of market sales, including me), seeing only the "IdZonaGestion" that are mine (<> from "OTR") but with the total sales of market in last column ("Ventas USD IMS Mercado").

 

Hope I'm clear and somebody can help me with this.

 

Thanks in advance.

  • Vvelarde's avatar
    Vvelarde
    9 years ago

    Anonymous

     

    Check the PBIX.

     

    https://drive.google.com/file/d/0B95C8CKdTZE3ZVdvY2lNR2YyczA/view?usp=sharing

     

     

    ImporteVendidoTotal =
    VAR PAIS =
        DISTINCT ( 'Zona-Gestión'[Pais] )
    RETURN
        IF (
            HASONEVALUE ( 'Zona-Gestión'[IdZonaGestion] ),
            IF (
                SEARCH ( "-OTR", VALUES ( 'Zona-Gestión'[IdZonaGestion] ),, BLANK () )
                    = BLANK (),
                CALCULATE (
                    SUM ( 'Ventas IMS'[ImporteVendidoUSD] ),
                    FILTER ( ALLSELECTED ( 'Ventas IMS' ), 'Ventas IMS'[IdPaisIMS] = PAIS ),
                    ALLEXCEPT ( 'Ventas IMS', 'Ventas IMS'[IdAnio], 'Ventas IMS'[IdMes] )
                )
            ),
            SUM ( 'Ventas IMS'[ImporteVendidoUSD] )
        )

     

    Regards

     

    Victor

    Lima - Peru

11 Replies

  • Vvelarde's avatar
    Vvelarde
    Community Champion

    Anonymous

     

     

    Hi, What option do you want to see? or a different ?

     

     

     

    Regards

     

    Victor

    Lima - Peru