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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
AmeenVanakar
Advocate II
Advocate II

Need Help in grouping by value in a calculated table

Hi,

I am trying to group unique invoices by their bill value. I tried the below formula but something doesnt seem to work & I am getting an error "Argument '16' in SWITCH function is required."

 

Bill Range =
SWITCH(
    TRUE(),
    'Unique Bill Number'[Bill Value]<=1000,"Below 1000",
    'Unique Bill Number'[Bill Value]>1000 && 'Unique Bill Number'[Bill Value]<2000, "1001 - 2000",
    'Unique Bill Number'[Bill Value]>2000 && 'Unique Bill Number'[Bill Value]<3000, "2001 - 3000",
    'Unique Bill Number'[Bill Value]>3000 && 'Unique Bill Number'[Bill Value]<4000, "3001 - 4000",
    'Unique Bill Number'[Bill Value]>4000 && 'Unique Bill Number'[Bill Value]<5000, "4001 - 5000",
    'Unique Bill Number'[Bill Value]>5000 && 'Unique Bill Number'[Bill Value]<10000, "5001 - 10000",
    'Unique Bill Number'[Bill Value]>10000, "Above 10000",
)
AmeenVanakar_0-1727958830684.png

 

1 ACCEPTED SOLUTION
Jonvoge
Super User
Super User

Hi AmeenVanakar

 

I believe you simply need to remove the final comma after "Above 10000", in the line ''Unique Bill Number'[Bill Value]>10000, "Above 10000",'. 

That final comma makes the switch statement believe that more arguments are coming.

_____________________________________________________
I hope my comment was helpful.
If your question was answered, please mark your post as 'Solved' and consider giving me a 'Thumbs Up'.
Find me on LinkedIn, Sessionize, or my blog Downhill Data

View solution in original post

3 REPLIES 3
Kedar_Pande
Super User
Super User

@AmeenVanakar ,

Corrected formula

Bill Range =
SWITCH(
TRUE(),
'Unique Bill Number'[Bill Value] <= 1000, "Below 1000",
'Unique Bill Number'[Bill Value] > 1000 && 'Unique Bill Number'[Bill Value] < 2000, "1001 - 2000",
'Unique Bill Number'[Bill Value] > 2000 && 'Unique Bill Number'[Bill Value] < 3000, "2001 - 3000",
'Unique Bill Number'[Bill Value] > 3000 && 'Unique Bill Number'[Bill Value] < 4000, "3001 - 4000",
'Unique Bill Number'[Bill Value] > 4000 && 'Unique Bill Number'[Bill Value] < 5000, "4001 - 5000",
'Unique Bill Number'[Bill Value] > 5000 && 'Unique Bill Number'[Bill Value] < 10000, "5001 - 10000",
'Unique Bill Number'[Bill Value] > 10000, "Above 10000",
"Unknown" // Default value if none of the conditions are met
)


If this helped, a Kudos 👍 or Solution mark would be great!
Cheers,
Kedar Pande
www.linkedin.com/in/kedar-pande

Jonvoge
Super User
Super User

Hi AmeenVanakar

 

I believe you simply need to remove the final comma after "Above 10000", in the line ''Unique Bill Number'[Bill Value]>10000, "Above 10000",'. 

That final comma makes the switch statement believe that more arguments are coming.

_____________________________________________________
I hope my comment was helpful.
If your question was answered, please mark your post as 'Solved' and consider giving me a 'Thumbs Up'.
Find me on LinkedIn, Sessionize, or my blog Downhill Data

Problem solved! Thanks @Jonvoge 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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