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
Anonymous
Not applicable

DAX - Performance change

I have data that looks like this:

 

NamePerformanceYear
JohnHigh2020
JohnSolid2019
AndrewExceptional2020
AndrewHigh2019
MaryBelow2020
MaryBelow2019

 

I need to create 3 cards: % of these people that increased performance, % of these people that kept same performance and % of these people that decreased their performance.

 

How can I do this through DAX?

 

ps. I can't create calculated columns, or add any columns because it's a restricted database

5 REPLIES 5
Fowmy
Super User
Super User

@Anonymous 

Create a table for Performance Ranking

Fowmy_0-1600984848114.png


Link Performance and Ranking

Fowmy_1-1600984908665.png

Add the Measures ( You change the sign ">" to "<" for Decreased % and "=" for Same %

Increased % = 
VAR __R = 
SUMX(
    ALLEXCEPT(Table6,Table6[Name]),
        IF( 
            Table6[Year] = 2020 && 
            RELATED('Performance Table'[RankNo]) > minX(FILTER( Table6 , Table6[Year]= 2019), RELATED('Performance Table'[RankNo])),
            1,
            0
        )
    )

VAR __C = COUNTROWS(ALL(Table6[Name]))

RETURN

DIVIDE(
    __R,
    __C
)

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

@Fowmy I can't add any columns, it's a restricted database. Is there a way to do it all through DAX?

@Anonymous 

Add the following Measure, no need to create a table or add columns.
This Measure is for Increased, for Decreased, and Same only adjust the 3rd Row from last to [Rank] < 0 and [Rank] = 0 respectively.

 

Increased% M = 
VAR T1 = { ( "Below", 1 ), ( "Solid", 2 ), ( "High", 3 ), ( "Exceptional", 4 ) }
VAR T2 =
    FILTER ( GENERATE ( table6, T1 ), Table6[Performance] = [Value1] )
VAR T3 = 

ADDCOLUMNS(
    FILTER (
        GENERATE (
            table6,
            SELECTCOLUMNS (
                T2,
                "xName", table6[Name],
                "xPerformance", table6[Performance],
                "xYear", table6[Year]
            )
        ),
        Table6[Name] = [xName]
            && Table6[Year] = 2020
            && [xYear] = 2019
    ),
    "Rank", MAXX(FILTER(T1,Table6[Performance] = [Value1]),[Value2]) -  MAXX(FILTER(T1,[xPerformance] = [Value1]),[Value2])
)

RETURN
DIVIDE(
    COUNTROWS(FILTER(T3,[Rank] > 0)),
    COUNTROWS(ALL(Table6[Name]))
)

 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

@Fowmy Performance, Name and Date are actually in 3 different tables that are related. Can you adjust the measure taking that into consideration, please

@Anonymous 


The measure is based on a single table, if all those columns come from different tables, 

The best approach will be to request your data source owner to provide you a table in the format you shared. 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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