Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
amolgharge
New Member

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,09,09,10,10 October 2021 records ( from sale amount 61,048.20 to 1.27.819.90)  datewise with Total Sale. I tried a lot but not getting required output. Kindly  provide me DAX .

Thank You.

 


Sale Data.jpg

1 REPLY 1
bhanu_gautam
Super User
Super User

@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.

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.