cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
gringo89
Helper I
Helper I

Contar el stock de pasos en una fecha específica

Hola

En primer lugar, lo siento por mi inglés.

Queremos restituir el número de documentos en cada estado por fecha.

A mi tabla de hechos le gusta :

UsuariosEvento de fechaEscriba evento
101/03/2020Sended
104/03/2020Recevied
106/03/2020Integrado
106/03/2020Terminado
201/03/2020Sended
203/03/2020Recibido
302/03/2020Sended
310/03/2020Recibido
311/03/2020Integrado
315/03/2020Terminado
405/03/2020Sended
406/03/2020Recibido
407/03/2020Integrado

El documento de flujo de trabajo es: Sended, received, integrated y finished

Tengo 3 dimensiones: fecha, evento de tipo de usuario.

En cada fecha, quiero saber el stock en cada evento de tipo:

Eventos de tipo01/03/202002/03/202003/03/202004/03/202005/03/202006/03/202007/03/202008/03/202009/03/202010/03/202011/03/202012/03/202013/03/202014/03/202015/03/2020
Sended232121111000000
Recibido001222111211111
Integrado000000111122221
Terminar000001111111112

Quiero crear una medida, pero no sé la sintaxis dax que puede hacerlo.

Gracias por su ayuda

4 REPLIES 4
v-lid-msft
Community Support
Community Support

Hola @gringo89 ,

Podemos usar los siguientes pasos para cumplir con sus requisitos.

  1. agregue una columna de índice para la tabla de hechos en Power Query.

  1. Y necesitamos crear relaciones entre tablas,

35.png

  1. Entonces podemos crear una medida para obtener el resultado,
Measure =
COUNTROWS (
    FILTER (
        SUMMARIZE (
            FILTER (
                ALLSELECTED ( 'fact table' ),
                'fact table'[Date event] <= MIN ( 'Dim Date'[Date] )
            ),
            'fact table'[users],
            "LastType",
            VAR maxIndex =
                CALCULATE (
                    MAX ( 'fact table'[Index] )
                )
            RETURN
                CALCULATE (
                    MAX ( 'fact table'[Type event] ),
                        'fact table'[Index] = maxIndex
                )
        ),
        [LastType] IN DISTINCT ( 'Dim Type event'[Type event] )
    )
) +0

36.png

BTW, pbix como adjunto.


Saludos

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hola @v miembro-msft

gracias por su ayuda.

Creo que este enfoque puede resolver mi requisito.

Utilizo la conexión en vivo SSAS (versión 2016) y tengo un error con la sintaxis 'IN DISTINCT'. No entiendo...

Hummm.. el operador 'in' no es compatible con sql server 2016 (compatible con 1200 tabular) 😞

Hola a todos

¿Alguna solución para este requisito?

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors