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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
FRG
Resolver I
Resolver I

Add a new filtered colum

Hi BI Community,

I have Table#1

IDProduction       IDProcess       TimeShiftBegin                TimeShiftEnd

1000                           1          2018-04-19 06:45:00       2018-04-19 08:45:00

1001                           2          2018-04-19 06:45:00       2018-04-19 08:45:00

1002                           3          2018-04-19 06:45:00       2018-04-19 08:45:00

1003                           1          2018-04-19 09:00:00       2018-04-19 11:00:00

1004                           2          2018-04-19 09:00:00       2018-04-19 11:00:00

....

 

And Table#2

ScalingID       Volume         Lenght              ScaledOn

22000                 45                 8            2018-04-19 06:45:18

22001                 45                 10          2018-04-19 06:45:43

22002                 30                 8            2018-04-19 06:46:04

 

In Table#2 I want to had Table#1[IDProduction] when ScaledOn date is between Table#1[TimeShiftBegin] and Table#1[TimeShiftEnd] and when Table#1[IDProcess] =2. Like this:

 

ScalingID       Volume         Lenght              ScaledOn                  IDProduction

22000                 45                 8            2018-04-19 06:45:18             1001

22001                 45                 10          2018-04-19 06:45:43             1001

22002                 30                 8            2018-04-19 06:46:04             1001

....

22223                 50                 9            2018-04-19 09:01:22             1004

22224                 35                 10          2018-04-19 09:01:54             1004

22225                 30                 8            2018-04-19 09:02:14             1004

          

Note that this 2 tables have nothing in common.

Thanks for your help!

FRG

1 ACCEPTED SOLUTION

Hi @v-xjiin-msft,

I find something and it seem to work.

FilteredIDProduction2 = CALCULATE(

                                                  MAXA(Table#1[idProduction]);

                                                  FILTER(

                                                         Table#1;Table#1[TimeShiftBegin] <= (Table#2[ScaledOn]) &&

                                                          Table#1[TimeShiftEnd] >= (Table#2[ScaledOn]) &&

                                                           Table#1[idProcess] = 2

                                                                        )

                                         )

 

Thanks again

View solution in original post

3 REPLIES 3
v-xjiin-msft
Solution Sage
Solution Sage

Hi @FRG,

 

Try this measure:

 

Filtered IDProduction =
CALCULATE (
    MAX ( 'Table#1'[IDProduction] ),
    FILTER (
        'Table#1',
        'Table#1'[TimeShiftBegin] <= MAX ( 'Table#2'[ScaledOn] )
            && 'Table#1'[TimeShiftEnd] >= MAX ( 'Table#2'[ScaledOn] )
            && 'Table#1'[IDProcess] = 2
    )
)

7.PNG

 

Thanks,
Xi Jin.

Hi @v-xjiin-msft,

With this measure I get the same (the last) IDProduction (where IDProcess =2) for all rows in Table#2.

Thanks

FRG

 

 

Hi @v-xjiin-msft,

I find something and it seem to work.

FilteredIDProduction2 = CALCULATE(

                                                  MAXA(Table#1[idProduction]);

                                                  FILTER(

                                                         Table#1;Table#1[TimeShiftBegin] <= (Table#2[ScaledOn]) &&

                                                          Table#1[TimeShiftEnd] >= (Table#2[ScaledOn]) &&

                                                           Table#1[idProcess] = 2

                                                                        )

                                         )

 

Thanks again

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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