Forum Discussion

WorldWide1's avatar
WorldWide1
Helper II
1 year ago
Solved

Return Single Value after Selection

Greetings -- would appreciate help understanding in PBI, what would be a Fixed calculation in Tableau.  (I've reviewed some posts here but not understanding).

In the data set sample below, what's happening is I have a set of ID's (1 and 2), each w/an associated SCAC and Cost and Code.  I'm building a table that will show, by ID, the lowest Total Cost and SCAC.  That part I have.  What I can't seem to find is how to return just the Code that is associated w/the ID/SCAC combination that is the lowest Total Cost.  What would that calculation look like?

Thank you for any help on this.

IDSCAC Total Cost Code IDLR SCAC Total Cost Code
1SAIA $       416.662 1RDFS $       355.234
1RDFS $       355.234 2ABFSN $       399.163
1EXLA $       473.342     
1CTII $       490.862     
1CNWY $       506.253     
1UPGF $       519.223     
1ABFS $       565.633     
1AACT $       601.952     
1RLCA $       720.902     
1ODFL $   1,420.252     
1SAIA2 $       487.582     
1EXLA2 $       442.420     
1FWRA $       427.272     
1FWRAC $       370.622     
1ABFSC $       775.563     
1CNWYC $       817.163     
1ABFSN $       663.973     
2CNWY $       531.962     
2UPGF $       465.861     
2RLCA $       547.512     
2DAFG $       472.972     
2EXLA $       483.622     
2SAIA $       664.782     
2ABFS $       571.093     
2ODFL $       893.091     
2EXLA2 $       433.820     
2SAIA2 $       478.932     
2CNWYC $       559.382     
2ABFSC $       455.323     
2FWRAC $   1,875.540     
2ABFSN $       399.163     
  • Hi WorldWide1 ,

     

    I assume when you refer to a table you mean a visualization create the following 3 measures:

     

    LR SCAC = MINX(TOPN(1, 'Table', 'Table'[Total Cost], ASC), 'Table'[SCAC])
    
    Total Cost Value = MINX(TOPN(1, 'Table', 'Table'[Total Cost], ASC), 'Table'[Total Cost])
    
    Code Value = MINX(TOPN(1, 'Table', 'Table'[Total Cost], ASC), 'Table'[Code])

     

    Now add the ID to a table and the measure you should get the following result.

     

2 Replies

  • Hi WorldWide1 ,

     

    I assume when you refer to a table you mean a visualization create the following 3 measures:

     

    LR SCAC = MINX(TOPN(1, 'Table', 'Table'[Total Cost], ASC), 'Table'[SCAC])
    
    Total Cost Value = MINX(TOPN(1, 'Table', 'Table'[Total Cost], ASC), 'Table'[Total Cost])
    
    Code Value = MINX(TOPN(1, 'Table', 'Table'[Total Cost], ASC), 'Table'[Code])

     

    Now add the ID to a table and the measure you should get the following result.