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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Return a value from a lookup table based off of a measure in a fact table

I have two related tables (1) a project listing[Project ID], [NAICS Code] table, and (*) a revenue table[Project ID], [Revenue].  I've calculated a measure for Revenue and I would like to return the [NAICS Code] in the Project ID table based on the MAX Revenue measure. All filters need to be removed to highlight the return value of the MAX Revenue by NAICS in a card visual. 

1 ACCEPTED SOLUTION
bcdobbs
Super User
Super User

Try the following.

First a basic measure for total revenue:

Total Revenue = 
    SUM ( Revenue[Revenue] )

 

Then the following will return the project with max revenue (or if there are ties will return a comma separate list):

Top Project = 

VAR MaxRevenue = 
    CALCULATE(
        MAXX(
            VALUES(Project[ProjectId]),
            [Total Revenue]
        ),
        REMOVEFILTERS(Project)
    )

VAR Result =
    CONCATENATEX(
        FILTER(Project, [Total Revenue] = MaxRevenue),
        Project[NAICS Code],
        ", "
    )

RETURN Result


Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

View solution in original post

1 REPLY 1
bcdobbs
Super User
Super User

Try the following.

First a basic measure for total revenue:

Total Revenue = 
    SUM ( Revenue[Revenue] )

 

Then the following will return the project with max revenue (or if there are ties will return a comma separate list):

Top Project = 

VAR MaxRevenue = 
    CALCULATE(
        MAXX(
            VALUES(Project[ProjectId]),
            [Total Revenue]
        ),
        REMOVEFILTERS(Project)
    )

VAR Result =
    CONCATENATEX(
        FILTER(Project, [Total Revenue] = MaxRevenue),
        Project[NAICS Code],
        ", "
    )

RETURN Result


Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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