Forum Discussion

amolgharge's avatar
amolgharge
New Member
1 year ago
Solved

Display first 5 rows using DAX in Power BI

  I am new to Power BI. I have a table named 'Mobile Sales Data' having two columns 'Sales Date' and 'Total Sale' as shown here. Its date wise sale amount. I want to show - 1. First 5 rows i.e. 09...
  • bhanu_gautam's avatar
    1 year ago

    amolgharge 

    If you want to create a measure to filter the first 5 rows in a visual, you can use the following DAX formula:

    DAX
    First5RowsMeasure =
    IF(
    RANKX(
    ALL('Mobile Sales Data'),
    'Mobile Sales Data'[Sales Date],
    ,
    ASC
    ) <= 5,
    1,
    0
    )

     

    You can then use this measure in your visual filters to show only the rows where First5RowsMeasure equals 1.