Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
ajmonster
Helper II
Helper II

¿Cómo mostrar elementos que no existen?

Aquí está mi modelo de datos:

Tienda 1-* Ventas

Artículo 1-* Ventas

Quiero mostrar:

para cada tienda, qué artículos no ha vendido la tienda y las ventas medias de ese artículo en función de las ventas de otras tiendas de ese artículo específico.

Ejemplo:

La tienda A ha vendido $5 y $10 por valor de los Artículos 1 y 2, respectivamente.

La tienda B ha vendido $6 valor de los artículos 2 y 3 cada uno.

La tienda C ha vendido el artículo 1 por $2.

Quiero mostrar una lista que diga:

Tienda A

Tema 3..................................................................................................................................................................................................................................Y...................................................
Tienda B

Tema 1..................................................................................................................................................................................................................................................................................................................................................................................................................
Tienda C

Tema 2..................................................................................................................................................................................................................................................................................................................
Tema 3..................................................................................................................................................................................................................................Y...................................................

Idealmente, esta medida también me permitiría contar el número de tiendas que no están vendiendo un artículo específico.

Ejemplo: Usando el escenario anterior, tendría una tabla que dice

Tema 1..................................................................................................................................................................................................................................................................

Tema 2..................................................................................................................................................................................................................................................................

Tema 3..................................................................................2

1 ACCEPTED SOLUTION
v-deddai1-msft
Community Support
Community Support

Hola @ajmonster ,

Podemos intentar crear una tabla calculada separada y utilizar la siguiente medida en los objetos visuales de la tabla para satisfacer sus necesidades:

Table = 'Item'

Untitled picture6.png

Measure =

IF (

CALCULATE (

COUNTROWS ( Sales ),

FILTER ( Sales, Sales[Item ID] IN DISTINCT ( 'Table'[Item ID] ) )

) = 0,

CALCULATE (

AVERAGE ( 'Sales'[Price] ),

FILTER (

ALLSELECTED ( 'Sales' ),

'Sales'[Item ID] IN DISTINCT ( 'Table'[Item ID] )

)

),

BLANK ()

)



The measure is used to filter out the items not sold in the store and return its average price



Measure 2 =

SUMX (

    DISTINCT ( 'Item'[Item Name] ),

    CALCULATE (

        DISTINCTCOUNT ( 'Store'[Store ID] ),

        ALLSELECTED ( 'Sales'[Item ID] )

    )

        - CALCULATE ( DISTINCTCOUNT ( 'Sales'[Store ID] ) )

)



The measure is used to count the store that didn’t  sell the specific item.

Untitled picture7.png

Consulte el archivo pbix: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EYKEDu8HLuJAqRbVHK...

Saludos

Dedmon Dai

View solution in original post

5 REPLIES 5
v-deddai1-msft
Community Support
Community Support

Hola @ajmonster ,

Podemos intentar crear una tabla calculada separada y utilizar la siguiente medida en los objetos visuales de la tabla para satisfacer sus necesidades:

Table = 'Item'

Untitled picture6.png

Measure =

IF (

CALCULATE (

COUNTROWS ( Sales ),

FILTER ( Sales, Sales[Item ID] IN DISTINCT ( 'Table'[Item ID] ) )

) = 0,

CALCULATE (

AVERAGE ( 'Sales'[Price] ),

FILTER (

ALLSELECTED ( 'Sales' ),

'Sales'[Item ID] IN DISTINCT ( 'Table'[Item ID] )

)

),

BLANK ()

)



The measure is used to filter out the items not sold in the store and return its average price



Measure 2 =

SUMX (

    DISTINCT ( 'Item'[Item Name] ),

    CALCULATE (

        DISTINCTCOUNT ( 'Store'[Store ID] ),

        ALLSELECTED ( 'Sales'[Item ID] )

    )

        - CALCULATE ( DISTINCTCOUNT ( 'Sales'[Store ID] ) )

)



The measure is used to count the store that didn’t  sell the specific item.

Untitled picture7.png

Consulte el archivo pbix: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EYKEDu8HLuJAqRbVHK...

Saludos

Dedmon Dai

De hecho, he encontrado una mejor solución:

Voids = 
EXCEPT(
    CROSSJOIN(
    //items that have been sold in the last 4 weeks
        SELECTCOLUMNS(
                SUMMARIZECOLUMNS(
                    'Item Key'[Product Name],
                    FILTER(
                        'Item Key',
                        'Item Key'[4 Week Average Sales] > 0
                    )
                ),
            "Product Name", 'Item Key'[Product Name]
        ),
    //stores that have sales in the last 4 weeks
        SELECTCOLUMNS(
            FILTER(
                'Store Key',
                'Store Key'[4 Week Store Sales] > 0
            ),
            "Store Number", 'Store Key'[Store Number]
        )
    ),
    //current 4 week sales excluding items with no sales last 4w but sales LY 
    SELECTCOLUMNS(
        FILTER(
            'Item Level',
            'Item Level'[$ Sales] > 0 && 'Item Level'[Time Frame] = "Latest 4 Weeks"
        ),
        "Product Name", RELATED('Item Key'[Product Name]),
        "Store Number", 'Item Level'[Store Number]
    )
)

Esto hace exactamente lo que necesito. Esta es una tabla creada por DAX.

amitchandak
Super User
Super User

@ajmonster , ¿Puede compartir mejores datos de muestra y salida de muestra.

¿Qué calidad está buscando en la entrada/salida de muestra?

Tabla de artículos : ID de elementos,

{1, 2, 3, 4}
Tabla de almacenamiento : ID de almacén.
A, B, C, D-

Tabla de ventas (ID de tienda, ID de artículo, Importe de ventas)
(A, 1, $5), (A, 2, $10), (B, 2, $6), (B, 3, $6), (C, 1, $2)

Me gustaría que la salida fuera (usando el objeto visual de tabla/matriz):

(A, 3, $6)
(B, 1, $3.5)
(C, 2, $8)

(C, 3, $6)

Hola @ajmonster ,

¿Alguna vez has probado el archivo pbix que te he proporcionado anteriormente? ¿Cumplió con su requisito?

Saludos

Dedmon Dai

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors