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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
bilalkhokar73
Helper IV
Helper IV

Sales Amount grouping DAX

I have data in which I have Amount , month,year, order id , item id , customer id 
I want to make sales Group on amount that

1. < 100 Dollar amount how much Dollar Sold 

2. 100-200 Dollar how much Dolalr Sold

Here is my file link - https://we.tl/t-xEOgrvHW7O

Thsi is my Desired output < i have tried this formula but giving wrong result, my desired output i pasted in image down side

#SVGrp =
var a100=CALCULATE(COUNTROWS(Sheet1),Sheet1[Amnt]<100)
var o_200=CALCULATE(COUNTROWS(Sheet1),Sheet1[Amnt]>=100 && Sheet1[Amnt]<200)
var o_300=CALCULATE(COUNTROWS(Sheet1),Sheet1[Amnt]>=200 && Sheet1[Amnt]<300)
var o_400=CALCULATE(COUNTROWS(Sheet1),Sheet1[Amnt]>=300 && Sheet1[Amnt]<=400)
var a400=CALCULATE(COUNTROWS(Sheet1),Sheet1[Amnt]>400)


return
IF(a100>0,"<100",IF(o_200>0,"100-200",IF(o_300>0,"200-300",IF(o_400>0,"300-400",IF(a400>0,"400+")))))



bilalkhokar73_0-1645593915661.png

 

@amitchandak @Pragati11 @Anonymous 

1 ACCEPTED SOLUTION

Hello @bilalkhokar73 

 

 

I think there is no problem with the formula, but the aggregation method of amount needs to be changed to 'count'.

Is this what you want?

vjaneygmsft_1-1646040030929.png

vjaneygmsft_0-1646039897776.png

 

Best Regards,

Community Support Team _Janey

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

12 REPLIES 12
Samarth_18
Community Champion
Community Champion

Hi @bilalkhokar73 ,

 

You can create a column like this:-

#SVGrp = 
switch(true(),
Sheet1[Amnt]<100,"<100",
Sheet1[Amnt]>=100 && Sheet1[Amnt]<200,"100-200",
Sheet1[Amnt]>=200 && Sheet1[Amnt]<300,"200-300",
Sheet1[Amnt]>=300 && Sheet1[Amnt]<=400,"300-400",
Sheet1[Amnt]>400,"400+"
)

 

Are we sure we need Amout column in value section of matrix since data difference is huge between your expected output and actual data?

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

yes  i need amount column in values and expecyted dax column in rows as i want to see 100-200 what is value i am making, 200-300 what is the value i am making , make sure you select feb month 
@Samarth_18 
this is my file  https://we.tl/t-xEOgrvHW7O

Hi, @bilalkhokar73 

 

Is your problem solved? @Samarth_18 's reply seems to have met your requirements. You can accept his reply as solution to help the other members find it more quickly. If you have other questions, Please describe again.

 

Best Regards,

Community Support Team _Janey

no, still not solved

Hi @bilalkhokar73 

 

If it doesn't work. Can you show me what's the calculation logic of this column? sum or count? How to get this result? So we can help you.

vjaneygmsft_0-1646041092354.png

 

Best Regards,

Community Support Team _Janey

 

Hello @bilalkhokar73 

 

 

I think there is no problem with the formula, but the aggregation method of amount needs to be changed to 'count'.

Is this what you want?

vjaneygmsft_1-1646040030929.png

vjaneygmsft_0-1646039897776.png

 

Best Regards,

Community Support Team _Janey

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

 

VijayP
Super User
Super User

@bilalkhokar73  

var a_0100=CALCULATE(sum(SALESTABLE[Amnt]),Sum( SALESTABLE[Amnt]<100)
var a_100200=CALCULATE(sum(SALESTABLE[Amnt]),Sum( SALESTABLE[Amnt]<200)
var a_200300=CALCULATE(sum(SALESTABLE[Amnt]),Sum( SALESTABLE[Amnt]<300)
var a_300400=CALCULATE(sum(SALESTABLE[Amnt]),Sum( SALESTABLE[Amnt]<400)
var a_400=CALCULATE(sum(SALESTABLE[Amnt]),Sum( SALESTABLE[Amnt]>400) 

should be the approach

 




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


VijayP
Super User
Super User

@bilalkhokar73 

F(SELECTEDVALUE(salesgroupAmnt[Sales])=="0-100",a_0100,

 

After Sales why equal suymbol twice. It should be once

 




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


but still wrong after making one then also

VijayP
Super User
Super User

@bilalkhokar73 
Create a dummy Table - Home Tab->Enter Data 
Grouping (ColumnName)
0-100 

100-200
200-300

300-400

400 >
and create a DAX like this
Switch( Selectedvalue(Grouping),
"0-100",CALCULATE(COUNTROWS(Sheet1),Sheet1[Amnt]<100)
and so on the way you have created )

and then in a table visual add Groupoing Column name and above measure

This will create the desired result!




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


I tried this but giving this worng results
@VijayP 
#GRP =
var a_0100=CALCULATE(sum(SALESTABLE[Amnt]), SALESTABLE[Amnt]>=0 && SALESTABLE[Amnt]<100)
var a_100200=CALCULATE(sum(SALESTABLE[Amnt]),SALESTABLE[Amnt]>=100 && SALESTABLE[Amnt]<200)
var a_200300=CALCULATE(sum(SALESTABLE[Amnt]),SALESTABLE[Amnt]>=200 && SALESTABLE[Amnt]<300)
var a_300400=CALCULATE(sum(SALESTABLE[Amnt]),SALESTABLE[Amnt]>=300 && SALESTABLE[Amnt]<=400)
var a_400=CALCULATE(sum(SALESTABLE[Amnt]),SALESTABLE[Amnt]>400)
return
IF(SELECTEDVALUE(salesgroupAmnt[Sales])=="0-100",a_0100,
if(SELECTEDVALUE(salesgroupAmnt[Sales])=="100-200",a_100200,
IF(SELECTEDVALUE(salesgroupAmnt[Sales])=="200-300",a_200300,
IF(SELECTEDVALUE(salesgroupAmnt[Sales])=="300-400",a_300400,
IF(SELECTEDVALUE(salesgroupAmnt[Sales])=="400+",a_400 ) ))))

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors