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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

Problema comando ALL() con uso de jerarquía de fechas.

Buenos dias, estoy tratando de realizar el siguiente calculo en DAX pero me estoy encontrando con un problema.

 

Tengo una tabla de ventas que se llama VENTAS_FACT

Federico_Luzny_1-1659448564160.png

 

Lo que yo quiero mostrar la suma de clientes (distinct) por año en cada linea


Este seria el ejemplo de lo que necesito

Federico_Luzny_2-1659448653424.png

Ahora, cuando utilizo la formula siguiente logicamente me trae la suma de todos los clientes de la tabla sin importar el filtro año:

calculate(countrows(values(VENTAS_FACT[CODIGO_CLIENTE])), all(DM_FECHA))
 
Entonces, como estoy utilizando jerarquia de fechas, cuando modifico la formula y le agrego al parametro ALL el mes, no responde a lo que le estoy pidiendo
calculate(countrows(values(VENTAS_FACT[CODIGO_CLIENTE])), all(DM_FECHA[fecha].[Mes]))
 
Podran ayudarme a resolverlo?
Muchas gracias!

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , In the date table you should have a new column for month, year etc.

 

Also when mark that as date table you will not get hierarchy

 

calculate(countrows(values(VENTAS_FACT[CODIGO_CLIENTE])), all(DM_FECHA[Mes]))

 

example

Addcolumns(calendar(date(2020,01,01), date(2021,12,31) ), "Month no" , month([date])
, "Year", year([date])
, "Month Year", format([date],"mmm-yyyy")
, "Month year sort", year([date])*100 + month([date])
, "Month",FORMAT([Date],"mmmm")
, "Month sort", month([DAte])

)

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , In the date table you should have a new column for month, year etc.

 

Also when mark that as date table you will not get hierarchy

 

calculate(countrows(values(VENTAS_FACT[CODIGO_CLIENTE])), all(DM_FECHA[Mes]))

 

example

Addcolumns(calendar(date(2020,01,01), date(2021,12,31) ), "Month no" , month([date])
, "Year", year([date])
, "Month Year", format([date],"mmm-yyyy")
, "Month year sort", year([date])*100 + month([date])
, "Month",FORMAT([Date],"mmmm")
, "Month sort", month([DAte])

)

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Kudoed Authors