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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register 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
Anonymous
Not applicable

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

 

Anonymous
Not applicable

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
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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