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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
FelipeS
New Member

INTERVALO DE HORAS DE UM DIA AO OUTRO

Olá pessoal. Estou agarrado num problema já tem uns bons dias, o que ocorre: Eu tenho um painel que monitora em tempo real a produção, utilizo as informações do banco de dados, nos turnos do dia, eu utilizo o filtro "current_day" para restringir o dia e intervalo de horas. Porém, esse filtro não funciona para os turnos da noite, visto que ele começa num dia e termina em outro. Eu preciso criar um filtro que registre de 19 às 07, e as 07:01 do dia seguinte ele pare de contar, para não acumular de um dia para o outro, visto que a ideia do painel é monitorar apenas o turno atual.

3 REPLIES 3
v-stephen-msft
Community Support
Community Support

Hi @FelipeS ,

 

My understanding is that you want to create a slicer 'current_dayn' filters both the current day and the next day.

For example, if you select 'c', you will filter out rows from 7 p.m. to 7 a.m. the next day.

You can create a measure as a visual-level filter.

Measure = var _date=MAX('Table'[Date])
var _today=TODAY()
var _day=DAY(_date)
var _month=MONTH(_date)
var _year=YEAR(_date)
var _hour=HOUR(_date)
var _sel=SELECTEDVALUE('Table (2)'[Value])
var _day2=DAY(_today)
var _month2=MONTH(_today)
var _year2=YEAR(_today)
var _day3=DAY(_today+1)
var _month3=MONTH(_today+1)
var _year3=YEAR(_today+1)
return IF(ISFILTERED('Table (2)'[Value])&&_sel="CurrentDay",IF((_day=_day2&&_month=_month2&&_year=_year2&&_hour>=19) ||(_day=_day3&&_month=_month3&&_year=_year3&&_hour<8) ,1),1)

vstephenmsft_0-1721889701527.png

Today is 7/25/2024, so it filtered from 7/25/2024 19:00 to 7/26/2024 7:00.

vstephenmsft_1-1721889770309.png

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Olá, Stephen. Antes de qualquer coisa, agradeço a sua atenção e tempo para me ajudar. Recebi este erro quando coloquei o filtro, creio que possa ser pelo fato de na tabela onde a medida foi inserida, o valor filtrado não seja uma data (00/00/0000) e sim valor tipo numero (12345)

FelipeS_0-1721911422041.png

 

Hi @FelipeS ,

 

I don't understand Portuguese. Is it an error when you created this measure?

When was the error in the screenshot generated? The error looks like your date column is text, not the date type.

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

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!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.