Forum Discussion

han_rj's avatar
han_rj
Icon for Helper IV rankHelper IV
1 year ago
Solved

Translate the dax code to evaluate in Dax studio

Please may I have help know How should the below calulated column be coded in dax studio   productrankdense = VAR currentrow = 'Product'[Unit Price] RETURN COUNTROWS(FILTER(VALUES('Product'[Un...
  • Syndicate_Admin's avatar
    1 year ago

    If you need to add a calculated column showing the prices that pass the filter for each row, please use the following code in dax studio or in the powerbi query view. Please note that nested tables are not accepted in a cell of a powerbi table, therefore the value presented is a concatenation of the values in the field (you may not be able to see all the values included in the concatanation due to string constraints in that cell)
    If I responded to your query, please bookmark the post as a solution. Kudos 😀 are accepted

    DEFINE COLUMN 'Product'[NewCalculatedColum] =
            VAR PriceOfCurrentProduct = 'Product'[Unit Price]
            VAR MoreExpensiveProducts =
                FILTER (
                    'Product',
                    'Product'[Unit Price] > PriceOfCurrentProduct
                )
            RETURN
                CONCATENATEX (
                    MoreExpensiveProducts,
                    'Product'[Unit Price],
                    UNICHAR ( 10 ), 'Product'[Unit Price], DESC
    				
                )
    
    EVALUATE
    Product ORDER BY Product[Unit Price] DESC