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
Pandadev
Post Prodigy
Post Prodigy

Measure to include a multiple LookUP value not working

Hi I am trying to create formula , I wanted to add a final check to check if the maxLocationT was in a Table called bases and that was also looking at airline , to make each row of data in the table called hubs unique I created a column called FP Operator Airport , which is merged values of FP Operator&Arrival Airport. I then added two VAR in the formula below and looked to merge them for VLOOKUP looking at joined_ , but it does not work. Just checking to see if this is possible please. my formula is below

Hub = VAR baseDate_ =
TODAY ()
VAR maxLocationT_ =
TOPN (
1,
ADDCOLUMNS (
DISTINCT ( 'TU Feed'[Arrival Airport] ),
"@LocCount",
CALCULATE (
COUNT ( 'TU Feed'[Arrival Airport] ),
'TU Feed'[runway_departure] >= baseDate_ - 28,
'TU Feed'[runway_departure] < baseDate_ + 1
)
),
[@LocCount], DESC
)
VAR maxop_ =
TOPN (
1,
ADDCOLUMNS (
DISTINCT ( 'TU Feed'[FP Operator] ),
"@LocCount",
CALCULATE (
COUNT ( 'TU Feed'[FP Operator] ),
'TU Feed'[runway_departure] >= baseDate_ - 28,
'TU Feed'[runway_departure] < baseDate_ + 1
)
),
[@LocCount], DESC
)
 
VAR numMaxLocations_ =
COUNTROWS ( maxLocationT_ )
RETURN
IF (
numMaxLocations_ = 1,
IF (
MAXX (
maxLocationT_,
[@LocCount]
) >= 7,
VAR joined_ = (maxop_ & maxLocationT_)
LOOKUPVALUE('Hubs'[Type],
'Hubs'[FP Operator Airport],joined_,[FP Operator Airport]))
)
1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Pandadev ,

 

Without data is difficult to tell you what is not working one thing I notice on your measure is that the last variable JOINED_ is created but you don't have a return after it so it will keep not returnig values.

 

Measure updated below:

Hub =
VAR baseDate_ =
    TODAY ()
VAR maxLocationT_ =
    TOPN (
        1,
        ADDCOLUMNS (
            DISTINCT ( 'TU Feed'[Arrival Airport] ),
            "@LocCount",
                CALCULATE (
                    COUNT ( 'TU Feed'[Arrival Airport] ),
                    'TU Feed'[runway_departure] >= baseDate_ - 28,
                    'TU Feed'[runway_departure] < baseDate_ + 1
                )
        ),
        [@LocCount], DESC
    )
VAR maxop_ =
    TOPN (
        1,
        ADDCOLUMNS (
            DISTINCT ( 'TU Feed'[FP Operator] ),
            "@LocCount",
                CALCULATE (
                    COUNT ( 'TU Feed'[FP Operator] ),
                    'TU Feed'[runway_departure] >= baseDate_ - 28,
                    'TU Feed'[runway_departure] < baseDate_ + 1
                )
        ),
        [@LocCount], DESC
    )
VAR numMaxLocations_ =
    COUNTROWS ( maxLocationT_ )
RETURN
    IF (
        numMaxLocations_ = 1,
        IF (
            MAXX ( maxLocationT_, [@LocCount] ) >= 7,
            VAR joined_ = ( maxop_ & maxLocationT_ )
            RETURN
                LOOKUPVALUE (
                    'Hubs'[Type],
                    'Hubs'[FP Operator Airport], joined_,
                    [FP Operator Airport]
                )
        )
    )

 

Check if it works if not can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @Pandadev ,

 

Without data is difficult to tell you what is not working one thing I notice on your measure is that the last variable JOINED_ is created but you don't have a return after it so it will keep not returnig values.

 

Measure updated below:

Hub =
VAR baseDate_ =
    TODAY ()
VAR maxLocationT_ =
    TOPN (
        1,
        ADDCOLUMNS (
            DISTINCT ( 'TU Feed'[Arrival Airport] ),
            "@LocCount",
                CALCULATE (
                    COUNT ( 'TU Feed'[Arrival Airport] ),
                    'TU Feed'[runway_departure] >= baseDate_ - 28,
                    'TU Feed'[runway_departure] < baseDate_ + 1
                )
        ),
        [@LocCount], DESC
    )
VAR maxop_ =
    TOPN (
        1,
        ADDCOLUMNS (
            DISTINCT ( 'TU Feed'[FP Operator] ),
            "@LocCount",
                CALCULATE (
                    COUNT ( 'TU Feed'[FP Operator] ),
                    'TU Feed'[runway_departure] >= baseDate_ - 28,
                    'TU Feed'[runway_departure] < baseDate_ + 1
                )
        ),
        [@LocCount], DESC
    )
VAR numMaxLocations_ =
    COUNTROWS ( maxLocationT_ )
RETURN
    IF (
        numMaxLocations_ = 1,
        IF (
            MAXX ( maxLocationT_, [@LocCount] ) >= 7,
            VAR joined_ = ( maxop_ & maxLocationT_ )
            RETURN
                LOOKUPVALUE (
                    'Hubs'[Type],
                    'Hubs'[FP Operator Airport], joined_,
                    [FP Operator Airport]
                )
        )
    )

 

Check if it works if not can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.

Top Solution Authors