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
Alexis_96
Regular Visitor

Actualizar mi tablero al día anterior, semana anterior, mes anterior y acumulado.

¡Buenas tardes a todos!

Tengo un tablero en el cual represento gastos de nomina por ranchos.

Pero reqiero que las graficas y fichas que tengo, se actulicen con un segmentador de datos, pero ese segmentador de datos tiene que modificar de la siguiente manera la infromacion:

1.- Si estoy en el dia 21-02-2022, al momento de seleccionar el segmentador de dia, me tiene que dar toda la informacion del dia anterior.

2.- Si estoy en la semana 7, al momento de seleccionar el segmentador de semana, me tiene que dar toda la informacion de la semana 6.

Asi con el mes y el acumulado seria hasta la fecha en que este actualizado el informe.

 

Probó algunas funciones, pero aun no encontré la respuesta.

De favor me pudeiran apoyar?

 

si se requieren mas datos, con gusto lo puedo compartir,

 

Saludos, quedo atento a sus comentarios.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Alexis_96 , BAsed on today . no date is selected

 

 

yesterday=
var _max = today()-1

return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Table'), 'Table'[Date] =_max ) )

 

 

MTD=
var _max = if(day(today() )=1 , eomonth(today(),-1), today())
var _min = eomonth(_max,-1)+1

return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Table'),'Table'[Date] >= _min && 'Table'[Date] <=_max ) )


LMTD =
var _max1 = if(day(today() )=1 , eomonth(today(),-1), today())
var _max = date(year(_max1),month(_max1)-1, day(_max1))
var _min = eomonth(today(),-2)+1

return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Table'),'Table'[Date] >= _min && 'Table'[Date] <=_max ) )


This month Today =
var _min = eomonth(today(),-1)+1
var _max = eomonth(today(),0) //today()
return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Date] >= _min && 'Date'[Date] <=_max ) )

 

Use today if needed

Week =
var _max1 = maxx(allselected('Date'), 'Date'[Date]) // or _max1 = today()
var _stweek = _max1 +-1*WEEKDAY(_max1,2)+1
var _edweek= _max1+ 7-1*WEEKDAY(_max1,2)
return
calculate(sum(Table[Value]), filter(date, Date[Date] >=_stweek && Date[Date] <=_edweek))
// or use all date
//calculate(sum(Table[Value]), filter(all(date), Date[Date] >=_stweek && Date[Date] <=_edweek))

 

last week =
var _max1 = maxx(allselected('Date'), 'Date'[Date]) // or _max1 = today()
var _stweek = _max1 +-1*WEEKDAY(_max1,2)+1 -7
var _edweek= _max1+ 7-1*WEEKDAY(_max1,2) -7
return
calculate(sum(Table[Value]), filter(all(Date), Date[Date] >=_stweek && Date[Date] <=_edweek))

 

 

 

Check in case you have a date selected

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA
Power BI — Qtr on Qtr with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-qtd-questions-time-intelligence-2-5-d842063da839
https://www.youtube.com/watch?v=8-TlVx7P0A0
Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA
Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
https://www.youtube.com/watch?v=pnAesWxYgJ8
Day Intelligence - Last day, last non continous day
https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5-5c324...

View solution in original post

2 REPLIES 2
Alexis_96
Regular Visitor

Buenos dias

Gracias por la respuesta.

Solo me genera una duda; estas medidas las asignare a un filtro, para que me cambien todas mis tabals ?

O solo seria asignarlas al campo que corresponde?

amitchandak
Super User
Super User

@Alexis_96 , BAsed on today . no date is selected

 

 

yesterday=
var _max = today()-1

return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Table'), 'Table'[Date] =_max ) )

 

 

MTD=
var _max = if(day(today() )=1 , eomonth(today(),-1), today())
var _min = eomonth(_max,-1)+1

return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Table'),'Table'[Date] >= _min && 'Table'[Date] <=_max ) )


LMTD =
var _max1 = if(day(today() )=1 , eomonth(today(),-1), today())
var _max = date(year(_max1),month(_max1)-1, day(_max1))
var _min = eomonth(today(),-2)+1

return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Table'),'Table'[Date] >= _min && 'Table'[Date] <=_max ) )


This month Today =
var _min = eomonth(today(),-1)+1
var _max = eomonth(today(),0) //today()
return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Date] >= _min && 'Date'[Date] <=_max ) )

 

Use today if needed

Week =
var _max1 = maxx(allselected('Date'), 'Date'[Date]) // or _max1 = today()
var _stweek = _max1 +-1*WEEKDAY(_max1,2)+1
var _edweek= _max1+ 7-1*WEEKDAY(_max1,2)
return
calculate(sum(Table[Value]), filter(date, Date[Date] >=_stweek && Date[Date] <=_edweek))
// or use all date
//calculate(sum(Table[Value]), filter(all(date), Date[Date] >=_stweek && Date[Date] <=_edweek))

 

last week =
var _max1 = maxx(allselected('Date'), 'Date'[Date]) // or _max1 = today()
var _stweek = _max1 +-1*WEEKDAY(_max1,2)+1 -7
var _edweek= _max1+ 7-1*WEEKDAY(_max1,2) -7
return
calculate(sum(Table[Value]), filter(all(Date), Date[Date] >=_stweek && Date[Date] <=_edweek))

 

 

 

Check in case you have a date selected

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA
Power BI — Qtr on Qtr with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-qtd-questions-time-intelligence-2-5-d842063da839
https://www.youtube.com/watch?v=8-TlVx7P0A0
Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA
Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
https://www.youtube.com/watch?v=pnAesWxYgJ8
Day Intelligence - Last day, last non continous day
https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5-5c324...

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.