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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
sridharbabu
Helper I
Helper I

Show top 50 records in a table, the values are from measure

I have a table with ordern , location and a measure(Sales). The table shows only 2 months of data dynamically every month.

I want to show top 50 sales in the table. The sales is a measure.

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @sridharbabu,

Perhaps you can try to use the following measure formulas and use this on the chart 'visual level filter' to filter records based on flag:

flag =
VAR currOrdern =
    SELECTEDVALUE ( Table1[ordern] )
VAR currlocation =
    SELECTEDVALUE ( Table1[location] )
VAR summary =
    SUMMARIZE ( ALLSELECTED ( Table1 ), [ordern], [location], "_Sales", [Sales] )
VAR filtered =
    TOPN ( 50, summary, [_Sales], DESC )
RETURN
    IF (
        currOrdern
            IN SELECTCOLUMNS ( filtered, "ordern", [ordern] )
                && currlocation IN SELECTCOLUMNS ( filtered, "location", [location] ),
        "Y",
        "N"
    )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

6 REPLIES 6
v-shex-msft
Community Support
Community Support

HI @sridharbabu,

Perhaps you can try to use the following measure formulas and use this on the chart 'visual level filter' to filter records based on flag:

flag =
VAR currOrdern =
    SELECTEDVALUE ( Table1[ordern] )
VAR currlocation =
    SELECTEDVALUE ( Table1[location] )
VAR summary =
    SUMMARIZE ( ALLSELECTED ( Table1 ), [ordern], [location], "_Sales", [Sales] )
VAR filtered =
    TOPN ( 50, summary, [_Sales], DESC )
RETURN
    IF (
        currOrdern
            IN SELECTCOLUMNS ( filtered, "ordern", [ordern] )
                && currlocation IN SELECTCOLUMNS ( filtered, "location", [location] ),
        "Y",
        "N"
    )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

the measure is working fine. now to add rank to the table based on [sales]. can you help me on this.

This works fine for me, 

flag =
VAR currOrdern =
    SELECTEDVALUE ( Table1[ordern] )
VAR currlocation =
    SELECTEDVALUE ( Table1[location] )
VAR summary =
    SUMMARIZE ( ALLSELECTED ( Table1 ), [ordern], [location], "_Sales", [Sales] )
VAR filtered =
    TOPN ( 50, summary, [_Sales], DESC )
RETURN
    IF (
        currOrdern
            IN SELECTCOLUMNS ( filtered, "ordern", [ordern] )
                && currlocation IN SELECTCOLUMNS ( filtered, "location", [location] ),
        "Y",
        "N"
    )

 an added requirement is if duplicate record exist has to take latest record. and to show serial numbers from 1 to 50. could you please help me in excluding duplicate records.  

az38
Community Champion
Community Champion

Hi @sridharbabu 

you can press on your table visual, open filters pane and configure filter like this

az38_0-1706531123627.png

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

i applied top 2 fetch two months data, where i am having month no.  for the sales measure not gettig TOP in filters pane.

sridharbabu
Helper I
Helper I

and also how to load two months of data in totable dynamically. when the data is added to source table.

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 MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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