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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
driplytics
Frequent Visitor

Select a Table value based on a DAX function

Hey,

i have GDP data with colunms : Country, GDP, Year.

 

i used a Dax functions to calculate GDP Growth %, and ranked it In the Growth Rank Column.

Here's what i want to do :

I want to show the Year of highest Growth %  in a Card Visual (from the Table, it shows 1981), but can't seem to know how best to do it.

 

This is a table visual i created on power bi.

 

Table VisualTable Visual

 

 

 

 

 

 

 

 

 

Apart from Year and GDP Column every other Column is calculated using DAX.

 

Here are the formulas :

 

LY GDP =
var _Ly = LASTNONBLANK('Countries GDP 1960-2020'[Year],1) - 1
var _1 = CALCULATE([GDPc]ALL('Countries GDP 1960-2020'[Year]),
 'Countries GDP 1960-2020'[Year] _Ly )
return
_1
 
Growth % = DIVIDE((sum([GDP]) [LY GDP] ),[LY GDP])
 
Growth Rank = RANKX ( ALL ( 'Countries GDP 1960-2020'[Year] ),[Growth %] )
 
I have Gotten tremendious support from here, and i appreciate your responses.
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your data model looks like, but please try to put the below measure into a card visualization.

 

expected measure for card visual: =
SUMMARIZE (
    FILTER (
        ADDCOLUMNS (
            ALL ( 'Countries GDP 1960-2020'[Year] ),
            "@ranking", [Growth Rank]
        ),
        [@ranking] = 1
    ),
    'Countries GDP 1960-2020'[Year]
)


Microsoft MVP



If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.




LinkedInVisit my LinkedIn page




Outlook BookingSchedule a short Teams meeting to discuss your question



View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your data model looks like, but please try to put the below measure into a card visualization.

 

expected measure for card visual: =
SUMMARIZE (
    FILTER (
        ADDCOLUMNS (
            ALL ( 'Countries GDP 1960-2020'[Year] ),
            "@ranking", [Growth Rank]
        ),
        [@ranking] = 1
    ),
    'Countries GDP 1960-2020'[Year]
)


Microsoft MVP



If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.




LinkedInVisit my LinkedIn page




Outlook BookingSchedule a short Teams meeting to discuss your question



This is the Solution !!!

it worked. 

Thanks for Helping Out.

vapid128
Solution Specialist
Solution Specialist

add colnum

LastYearGDP = lookupvalue('Countries GDP 1960-2020'[GDP], 'Countries GDP 1960-2020'[Year], 'Countries GDP 1960-2020'[Year] - 1, 'Countries GDP 1960-2020'[Country], 'Countries GDP 1960-2020'[Country])

 

add measure

BestGDP = maxx(values( 'Countries GDP 1960-2020'[Year]), calculate(DIVIDE(sum('Countries GDP 1960-2020'[GDP])-sum('Countries GDP 1960-2020'[LastYearGDP]),sum('Countries GDP 1960-2020'[LastYearGDP]))

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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