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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
ankurshah01
Frequent Visitor

Get month value where rank = 1 from another Table

Hi All, 

 

I have a table that shows below data. 

Table A

CalmonthRank1Volume
Jan-23440
Feb-23150
Mar-23245
Apr-23634
May-23920
Jun-23825
Jul-23536
Aug-23730
Sep-231010
Oct-23118
Nov-23342

Rank1 is a measure.

Now based on above table, i need to get the Calmonth value where Rank1 = 1 in Table B. 

So in this case i will get Feb 2023. 

 

I created a new column in Table B & tried using Calculate with max & filter (where rank = 1) but it returns always Nov 2023. 

New Column = CALCULATE(max('Table A'[Calmonth]),FILTER('Table A', 'Table A'[Rank1] = 1))

I tried with different options using Lookup or selectedvalue but not getting required output. 

 

how to resolve this issue? 

 

Regards

Ankur

 

 

1 ACCEPTED SOLUTION

Hi, @ankurshah01 

kindly update your 
my rank measure is below

Measure =
  RANK(
    DENSE,
    ALL('Table'[volume]),
    ORDERBY('Table'[volume],DESC)
  )

 

and 

column dax is below

Column = 
 CALCULATE(
   MIN('Table'[calmonth]),
   FILTER('Table',[Measure]=1)
 )

 

 

 

above is work for me 
when i use rankx() instead of Rank() i got error like circular dependency detect 

rank1 = 
RANKX(ALL('Table'[volume]),'Table'[volume],MIN('Table'[volume]))

 

Dangar332_0-1703138913017.png

 

so update your rank code if it made from rankx()

View solution in original post

7 REPLIES 7
Dangar332
Super User
Super User

HI, @ankurshah01 

try below code for column

 

New Column = 
  CALCULATE(
      'Table A'[Calmonth],
       FILTER(
           all('Table A'[rank]),
           'Table A'[Rank1] = 1
       )
  )

 

Hi, 

Above code is not working since, after calculate there needs to be an expression. 

Regards

Ankur

Hi, @ankurshah01 

 

Can you clarify What problem you face?

Hi @Dangar332 , 


CALCULATE(
      'Table A'[Calmonth],
       FILTER(
I am not able to input above highlighted table & field after calculate.
It is only showing me Rank & Volume fields. 

 

Regards

Ankur

Hi, @ankurshah01 

@ankurshah01 

 

New Column = 

Var a = 'Table A'[Calmonth]

Return 

  CALCULATE( a,

           'Table A'[Rank1] = 1

       )

  

Or 

New column=

Minx(

       FILTER(

           'Table A',

           'Table A'[Rank1] = 1

       ),

 'Table A'[Calmonth]

)

 

 

Hi @Dangar332 , 

 

New Column = 

Var a = 'Table A'[Calmonth]

Return 

  CALCULATE( a,

           'Table A'[Rank1] = 1

       )

Above code is giving me -- >> 

A function 'PLACEHOLDER' has been used in a True/False expression that is used as a table filter expression. This is not allowed.

 

Below code is giving me value as Jan 2023 as output -- 

New column=

Minx(

       FILTER(

           'Table A',

           'Table A'[Rank1] = 1

       ),

 'Table A'[Calmonth]

)

 

Regards

Ankur

Hi, @ankurshah01 

kindly update your 
my rank measure is below

Measure =
  RANK(
    DENSE,
    ALL('Table'[volume]),
    ORDERBY('Table'[volume],DESC)
  )

 

and 

column dax is below

Column = 
 CALCULATE(
   MIN('Table'[calmonth]),
   FILTER('Table',[Measure]=1)
 )

 

 

 

above is work for me 
when i use rankx() instead of Rank() i got error like circular dependency detect 

rank1 = 
RANKX(ALL('Table'[volume]),'Table'[volume],MIN('Table'[volume]))

 

Dangar332_0-1703138913017.png

 

so update your rank code if it made from rankx()

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.