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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Suganya_Hemanth
New Member

DAX Query -.Get me the name of the customer who did the most sales in Bikes

EVALUATE
{
VAR a=Sales
VAR b=SUMX(a,FILTER(Products,'Products'[Category]="Bikes"))
VAR c=FILTER(Customers,'Customers'[Name]=b)
RETURN
c}
I am not getting answer for this.if anyone knows kindly let me know. Here Sales,Customers,Products are different tables.
 


1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Suganya_Hemanth ,

Here some steps that I want to share, you can check them if they suitable for your requirement.

Here is my test data:
Customers table:

vheqmsft_0-1705474052068.png
Products table:

vheqmsft_1-1705474080953.png

Sales table:

vheqmsft_2-1705474116274.png

1.Create a measure

Customer = 
VAR max_sales = CALCULATE(MAX(Sales[Amount]), Products[Category] = "Bike")
RETURN
    CALCULATE(
        VALUES(Customers[Name]),
        FILTER(
            Sales,
            Sales[Amount] = max_sales &&
            RELATED(Products[Category]) = "Bike"
        )
    )

2.Final output

vheqmsft_4-1705474267543.png

Best regards

Albert He

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Suganya_Hemanth ,

Here some steps that I want to share, you can check them if they suitable for your requirement.

Here is my test data:
Customers table:

vheqmsft_0-1705474052068.png
Products table:

vheqmsft_1-1705474080953.png

Sales table:

vheqmsft_2-1705474116274.png

1.Create a measure

Customer = 
VAR max_sales = CALCULATE(MAX(Sales[Amount]), Products[Category] = "Bike")
RETURN
    CALCULATE(
        VALUES(Customers[Name]),
        FILTER(
            Sales,
            Sales[Amount] = max_sales &&
            RELATED(Products[Category]) = "Bike"
        )
    )

2.Final output

vheqmsft_4-1705474267543.png

Best regards

Albert He

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
 

some_bih
Super User
Super User

Hi @Suganya_Hemanth assuming your model is model similar to DAX.DO, please check link with example.

Adjust your table / columns name.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Thanks to help in this.

Can i do the same without using Calculate Functions, ie by using variables.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.