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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
anil
Helper III
Helper III

Category Segmentation (Range Buckets) using direct query

My dataset has ID's with multiple orders. I am trying to calculate average discount across orders per ID.

And creating a column to bucket the averages of ID's. 

 

Bucket = Switch ( True(),
                           And( [Avg Discount %]>=-10 ,[Avg Discount %] < Sample[Fixed TMax Var 5%]) , "Green",
                           And( [Avg Discount %]>=Sample[Fixed TMax Var 5%],[Avg Discount %] < Sample[Fixed TMax Var 15%]) , "Yellow",
                           And(  [Avg Discount %] >= Sample[Fixed TMax Var 15%],[Avg Discount %] < 500),  "Red"
                         )

 

 

But when I am using the same formula to create a column. I am getting error "Function 'SUM' is not allowed as part of calculated column DAX expressions on DirectQuery models."

     I want to create a bar chart which shows the count of ID's in each segment. is there any alternate ways to achieve this? B1 (1).JPG

 

 

 

 

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

Hi @anil,

 

This is DAX Formula Compatibility limitation. When using DirectQuery mode, aggregation functions like COUNT, SUM, etc are supported in measure only. For more details, please see: DAX Formula Compatibility in DirectQuery Mode. You can switch the table from direct query to import to work around.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

3 REPLIES 3
v-frfei-msft
Community Support
Community Support

Hi @anil,

 

This is DAX Formula Compatibility limitation. When using DirectQuery mode, aggregation functions like COUNT, SUM, etc are supported in measure only. For more details, please see: DAX Formula Compatibility in DirectQuery Mode. You can switch the table from direct query to import to work around.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi @v-frfei-msft

 

     Thanks for the reply. But we wanted to create the reports using direct query mode. As the data set, we are working is very huge with constant updates. As power bi import mode data limit is 10 GB only we didn't want to go with import mode.

Hi @anil,

 

Maybe you can use composite models to make the Storage Model to be Mixed. For more details, please check the online document.

 

mixed.PNG

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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