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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
M4rc3l0
New Member

Aprendizado em DAX

  1. Esperava que a medida DAX a seguir retornasse algo diferente:
SalasBlocosDisponiveis =
VAR SelectedDia = SELECTEDVALUE(Semana[Dia])
VAR SelectedInicio = SELECTEDVALUE(Intervalos[Inicio])
VAR EmUso =
    SELECTCOLUMNS(
        FILTER(
            Ensalamento,
            Ensalamento[Dia] = SelectedDia &&
            Ensalamento[Inicio] = SelectedInicio
        ),
        "Bloco", Ensalamento[Bloco],
        "Curso", Ensalamento[Curso],
        "Dia", Ensalamento[Dia],
        "Docente", Ensalamento[Docente],
        "Fim", Ensalamento[Fim],
        "Inicio", Ensalamento[Inicio],
        "Oferta", Ensalamento[Oferta],
        "Sala", Ensalamento[Sala],
        "Sem./Ano", Ensalamento[Sem./Ano],
        "UC", Ensalamento[UC]
    )
VAR SalasBlocosOcupados =
    SELECTCOLUMNS(EmUso, "Sala", [Sala], "Bloco", [Bloco])
VAR SalasBlocosDisponiveis =
    EXCEPT(
        SELECTCOLUMNS(
            Ambiente,
            "Sala", Ambiente[Sala],
            "Bloco", Ambiente[Bl]
        ),
        SalasBlocosOcupados
    )
RETURN
IF(
    COUNTROWS(SalasBlocosDisponiveis) = 0,
    "Não há sala disponível",
    CONCATENATEX(SalasBlocosDisponiveis, [Bloco] & " - " & [Sala], ", ")
)
 
Preciso que, a partir da informação de hora de início e do dia, a medida verifique qual das salas relacionadas na tabela
'Ambiente' não constam na tabela 'Ensalamento'. Isto não está acontecendo, não sei por quê!
Por favor, ajudem-me!
6 REPLIES 6
M4rc3l0
New Member

The expected result is that you can manage the availability or not of classrooms, distributed in different buildings, in a school.

I cannot assist you if you are unable to provide sample data. I hope someone else can help you further.

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

I need to create a routine in Power BI that returns information about whether or not a room is available, based on a query in two tables. Steps: 1) the user will select the "day of the week" field and the "start time" field from the "Sitting room" table; 2) from the "Sitting room" table, the system will return all the "Room" and "Block" fields found; 3) then, the system should query the "Rooms" table, using the "Room" and "Block" fields from the "Sitting room" table as the primary key, compare the fields and return all the "Room" and "Block" fields from the "Rooms" table that do not appear in the query. In short: the routine should inform which room is available at a time and on a day of the week defined by the user.

Second request: Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

The following table is called "Classrooms". It contains data on classrooms occupied on a given day of the week and in a given time range.

 

Unitweekdaytime rangebuildingclassroom
Grupo Vocal e Instrumental VISegunda-feira09:10 - 10:40B3Laboratório Música
Grupo Vocal e Instrumental VISegunda-feira11:00 - 12:30B3Laboratório Música
TutoriaSegunda-feira07:20 - 08:50NI

NI

 

 

 

Linguagens da cena IVSegunda-feira19:20 - 20:05B2Laboratório Corpo em Movimento 2
Linguagens da cena IVSegunda-feira20:05 - 20:50B2Laboratório Corpo em Movimento 2
Linguagens da cena IVSegunda-feira21:00 - 21:45B2Laboratório Corpo em Movimento 2
Linguagens da cena IVSegunda-feira21:45 - 22:30B2Laboratório Corpo em Movimento 2
Linguagens da cena IITerça-feira19:20 - 20:05B2Laboratório Corpo em Movimento 1
Linguagens da cena IITerça-feira20:05 - 20:50B2Laboratório Corpo em Movimento 1
Linguagens da cena IITerça-feira21:00 - 21:45B2Laboratório Corpo em Movimento 1
Linguagens da cena IITerça-feira21:45 - 22:30B2Laboratório Corpo em Movimento 1

 

 

The following table is called "Environments". It contains data for all available classrooms in different buildings:

 

BlSala
B1Laboratório Audiovisual
B2EAD
B2Laboratório Biologia
B2Laboratório Corpo em Movimento 01 - Artes
B2Laboratório Corpo em Movimento 02 - Ed. Física
B3Laboratório Música
B3Análise Sensorial

 

When the user selects the variable "Monday" in the "weekday" field and the variable "09:10 - 10:40" in the "time range" field, it will return that the classroom 'Music Lab' in building 'B3' is occupied.
The routine should query the "Environments" table, using the fields "Classroom" and "Building" as the primary key, and return all the "Classrooms" that are available. In this example, "B1 - Laboratorio Audiovisual"; "B2 - EAD"; "B2 - Laboratorio Biologia" and so on.

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.