Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

top 15

hi i want to flag the top 15 account 

i have thos table 

dim date, dim payer and fact transaction 

dim date conact to fact transaction with date to date transaction 

i want to create a flage that show the top 15 account base on a mesure that call 'All fees'

 the flag need to be daynamic to the date that will be choosen on the filter 

 

i try this:

top_15_customers =
var _account=FIRSTNONBLANK(dimPayer[Account_Name],1=1)
VAR _MyProjectCode = CALCULATETABLE(values(dimPayer[Account_Name]),TOPN(15,dimPayer,[All Fees]))
RETURN
CALCULATE(
SUMX(_MyProjectCode,[All Fees]),FILTER(_MyProjectCode,FIRSTNONBLANK(dimPayer[Account_Name],1=1)=_account))
 
pls help 🙂
  • Anonymous In that case, can you paste sample data or provide a link to the PBIX? Guessing otherwise but you might want:

    Top_15_Customers_Measure =
      VAR __AccountName = MAX([Account_Name])
      VAR __Table = SUMMARIZE(ALL('dimPayer'),[Account_Name],"__fees",[All fees])
      VAR __Top15 = SELECTCOLUMNS(TOPN(15,__Table,[__fees],DESC),"Account_Name",[Account_Name])
    RETURN
      IF(__AccountName IN __Top15,1,0)

     

3 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Anonymous Use the Filters pane for this on Account_Name, switch to Top N filtering and use your measure.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Greg, 

      i want to gett a list of all the account and then to conditional formatting the top 15.

       

      i think the filter pan will not help me 

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        Anonymous In that case, can you paste sample data or provide a link to the PBIX? Guessing otherwise but you might want:

        Top_15_Customers_Measure =
          VAR __AccountName = MAX([Account_Name])
          VAR __Table = SUMMARIZE(ALL('dimPayer'),[Account_Name],"__fees",[All fees])
          VAR __Top15 = SELECTCOLUMNS(TOPN(15,__Table,[__fees],DESC),"Account_Name",[Account_Name])
        RETURN
          IF(__AccountName IN __Top15,1,0)