Forum Discussion

sowmyar's avatar
sowmyar
Frequent Visitor
3 years ago

Ranking in MAtrix

I created rank measure and applied to the matrix with 4 categories the  ranking is fine for the first level(customer) and the ranking changes whe i expand the matrix .But in my scenario i just need rank for customer and the same rank should be there for all the other categories,becoz i will filter the top 10  and top 20 rank

 

the rankis fine for the first level without expanding

its skipping rank 10-dont know why

 

 

Rank = CALCULATE(RANKX(ALLselected('Fact'[Customer]),CALCULATE(SUM('Fact'[Factored_Turnover_Customer]),ALLEXCEPT('Fact','Fact'[Customer],'Fact'[Year],'Fact'[Tender Type],'Fact'[Lead/Tender Schedule])),,DESC,Dense),ALLSELECTED('Fact'[Year],'Fact'[Sales_Stage],'Fact'[Project])) this is y rank measure and after  which i need to show top 10,20,...50 baased on customer selection
 
Thanks in advance

2 Replies

  • sowmyar's avatar
    sowmyar
    Frequent Visitor

    I worked fine for first level only with customer

    when i added another row (year field) it showed me additional 2 data

    should we add the year fields to the columns only?

    TopN customer =
    VAR SelectedTop = SELECTEDVALUE('rankingrange'[rankingrange])
    RETURN
    SWITCH(TRUE(),
    SelectedTop = 0, [Sales(Customer)],
    RANKX (
    ALLSELECTED( 'Fact'[Customer]),
    [Sales(Customer)]
    )
    <= SelectedTop,
    [Sales(Customer)]
    )
     
    Sales(Customer) =
    CALCULATE(SUM('Fact'[Factored_Turnover_Customer]))