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
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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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