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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Syndicate_Admin
Administrator
Administrator

Ventas medias excluyendo días en blanco

Hola a todos,

con el cálculo a continuación, pude calcular las ventas diarias promedio como se ve en la pantalla a continuación, pero tendría que ajustar mi cálculo para excluir los días en blanco / cero. ¿Podría por favor ayudar? El resultado esperado es el promedio de los dos valores de la columna "Ventas netas".

Cálculo original:

Daily AVG = 
VAR selectedDate = SELECTEDVALUE('Date'[Date])

VAR Res = SELECTEDVALUE(Restaurant[Restaurant Name]) 

RETURN

CALCULATE(SUM('Daily Sales Report'[Net Sales]); MONTH('Date'[Date])=MONTH(selectedDate); YEAR('Date'[Date])=YEAR(selectedDate); Restaurant[Restaurant Name]= Res)/CALCULATE(DISTINCTCOUNT('Date'[Date]);MONTH('Date'[Date])=MONTH(selectedDate); YEAR('Date'[Date])=YEAR(selectedDate); Restaurant[Restaurant Name]= Res;'Daily Sales Report'[Net Sales]>0)

tktom_0-1648216767852.png

Gracias

Tomas

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

Daily Avg =
var selectedDate = SELECTEDVALUE('Date'[Year month])
var result = AVERAGEX( ADDCOLUMNS( 
   CALCULATETABLE( VALUES( 'Date'[Date]), REMOVEFILTERS('Date'), 
      'Date'[Year month] = SELECTEDVALUE('Date'[Year month]) ),
   "@val", CALCULATE( [Net Sales] ),
[@val])
return result

View solution in original post

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

Daily Avg =
var selectedDate = SELECTEDVALUE('Date'[Year month])
var result = AVERAGEX( ADDCOLUMNS( 
   CALCULATETABLE( VALUES( 'Date'[Date]), REMOVEFILTERS('Date'), 
      'Date'[Year month] = SELECTEDVALUE('Date'[Year month]) ),
   "@val", CALCULATE( [Net Sales] ),
[@val])
return result

¡Gracias, muy apreciado!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.