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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
vini_udenia
Helper I
Helper I

Create a new column based on Previous column rank

Hi, 

I'm looking for a way to create a new column in my PBI report based on the  value in previous session. So for School 505 # of candidates in current session is 100, the new column should display the # of candidates in the previous session ie (June 2022 - identified by using Session Rank -1) to show 55.

 

I know can be done using DAX , any help appreciated! TIA

 

SchoolYear MonthSesion Rank# Candidates# Candidates Previous Session
5052022JUNE1550
5052022DEC210055
5062022JUNE1650
5062022DEC27065
1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @vini_udenia,

You can use School and Year field values as group and use current session rank as condition to lookup the previous records.

formula =
MAXX (
    FILTER (
        Table,
        [School] = EARLIER ( Table[School] )
            && [Year] = EARLIER ( Table[Year] )
            && [Sesion Rank]
                = EARLIER ( Table[Sesion Rank] ) - 1
    ),
    [# Candidates]
) + 0

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
lbendlin
Super User
Super User

Power BI has no concept of "previous".  You either need to provide indexing guidance, or use the new OFFSET function to indicate what you mean by "previous"

v-shex-msft
Community Support
Community Support

Hi @vini_udenia,

You can use School and Year field values as group and use current session rank as condition to lookup the previous records.

formula =
MAXX (
    FILTER (
        Table,
        [School] = EARLIER ( Table[School] )
            && [Year] = EARLIER ( Table[Year] )
            && [Sesion Rank]
                = EARLIER ( Table[Sesion Rank] ) - 1
    ),
    [# Candidates]
) + 0

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Thank you Xiaoxin, Worked like a charm 👍

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors