Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Filtering after Date hour

Hi everybody, I'm new using PowerBI, I started 2 days ago with a webbinnar but I'm having a lot of problems with one challenge: filtering between Dates with Hours.

 

In my report, I need to filter by Day and Time to know how many people has been logged, I can easily filter between dates with the Date slicer, but I want to specify the hour too.

 

I've created another auxiliar table called 'Table' and related with my primary table 'Log'. Then I've created the following mesure:

 

Prueba = IF(MAX('BatchTemporales'[Hora Filter])>=MAX('Table'[Hora Filter2]);TRUE();FALSE())

I want to filter the times after the selected hour ('Table'[Hora Filter2]), but it just work when both values are equal:

 

Demo

 

As you can see, I expect when HoraFilter is >= than HoraFilter2, my flag is TRUE.

 

Can you help me?

  • hi, Anonymous

    I have tested on my side, but not reproduce the issue. and we need more detail steps for us.

    For example:
    Prueba = IF(MAX('BatchTemporales'[time])>=MAX('Table'[time2]),TRUE(),FALSE())
    So I want to know:
    What is the relationship between 'Table' and 'BatchTemporales' ?
    In my sample pbix file, my 'Table'  is a date table with date and time as below:
    and they create a relationship by date column
     
    So what is relationship in your pbix file, it is better you could share some sample data with model structure for us.
     
     

    Best Regards,

    Lin

     
     

6 Replies

  • v-lili6-msft's avatar
    v-lili6-msft
    Icon for Community Support rankCommunity Support

    hi, Anonymous

    I have tested on my side, but not reproduce the issue. and we need more detail steps for us.

    For example:
    Prueba = IF(MAX('BatchTemporales'[time])>=MAX('Table'[time2]),TRUE(),FALSE())
    So I want to know:
    What is the relationship between 'Table' and 'BatchTemporales' ?
    In my sample pbix file, my 'Table'  is a date table with date and time as below:
    and they create a relationship by date column
     
    So what is relationship in your pbix file, it is better you could share some sample data with model structure for us.
     
     

    Best Regards,

    Lin

     
     
    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you very much! The problem was my relation between tables!

  • themistoklis's avatar
    themistoklis
    Icon for Community Champion rankCommunity Champion

    Anonymous

     

    Why dont you use a calculate column and not a measure

     

    Prueba = IF('BatchTemporales'[Hora Filter]>='Table'[Hora Filter2];TRUE();FALSE())
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi themistoklis, I've tried but as [Hora Filter2] is a variable that user selects, I think I've to use a Mesure.

       

      Do you have another idea?

  • AlB's avatar
    AlB
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous

     

    What type is the data in fields 'Hora Filter' and 'Hora Filter2'?

    Can you share your pbix file (with dummy data if necessary)? 

    • Anonymous's avatar
      Anonymous
      Not applicable

      Now I can't upload my .pbix because I have limited my job network, but I attach you two captures:

       

      Hope it can help you, thanks!