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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It 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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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