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
Anonymous
Not applicable

Grouping continuous measure into groups in DirectQuery

Hi,

 

I have the following below which I want to make group based on % so:
What I have:

Xilitor01_0-1654080091417.png



What I'm looking for:

Xilitor01_1-1654080198608.png

 

NOTE: This has to be implemented in a DirectQuery context!

 

I hope someone can help 🙂

1 ACCEPTED SOLUTION

Hi @Anonymous 

I'll test it later under DQ mode, before that, do you have dimension table containing groups?

vxiaotang_0-1654595745965.png

If not, you need to use switch() to get the expected outcome.

-

Update:

create the measure below

group = 
var _value=[Measure]
return SWITCH(TRUE(),
_value>0&&_value<=0.25,"0 % - 25 %",
_value>0.25 && _value<=0.5,"25 % - 50 %")

vxiaotang_1-1654596096196.png

 

Best Regards,

Community Support Team _Tang

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

View solution in original post

8 REPLIES 8
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

Could you please provide some sample data?

usually information below is needed

 (1) a sample file, you can replace raw data with bogus data to protect your privacy.

     or provide some sample data that fully covers your issue/question.

(2) give your expected result and its math formula based on the sample you provide.

 

Best Regards,

Community Support Team _Tang

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

Anonymous
Not applicable

Hi Xiaotang,

 

I cannot provide data as it is running in DirectQuery.

But it is more of a conceptual question: Is it possible to group/segment values in DirectQuery?

For instance if a value in a measure is between 0 and 0,25 then the group should be '0 % - 25 %' and if the value is between 0,25 and 0,5 it should be grouped into '25 % - 50 %'. I've tried to create an example below.

ValueGroup
0,100 % - 25 %
0,150 % - 25 %
0,210 % - 25 %
0,2625 % - 50 %
0,3725 % - 50 %

Hi @Anonymous 

I'll test it later under DQ mode, before that, do you have dimension table containing groups?

vxiaotang_0-1654595745965.png

If not, you need to use switch() to get the expected outcome.

-

Update:

create the measure below

group = 
var _value=[Measure]
return SWITCH(TRUE(),
_value>0&&_value<=0.25,"0 % - 25 %",
_value>0.25 && _value<=0.5,"25 % - 50 %")

vxiaotang_1-1654596096196.png

 

Best Regards,

Community Support Team _Tang

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

Anonymous
Not applicable

I know I have set it to solved but I can see that it does not help my problem unfortunately.

This is my data below with the measure. The problem is that I cannot count the number of products within each group:

Xilitor01_0-1654775931201.png

 

If I count:

Xilitor01_1-1654775971397.png

 

 

I want to count the number of products within the different percentage-groups.

Hi  @Anonymous 

If you want to count each group, you need to have a dimension table containing groups.

vxiaotang_1-1654848006846.png

Then create the measure

count = CALCULATE(COUNTROWS('Sheet2$'),FILTER('Sheet2$','Sheet2$'[group]=MIN('Group'[group])))

 

vxiaotang_0-1654847922968.png

 

Best Regards,

Community Support Team _Tang

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

Anonymous
Not applicable

It says it cannot find the table 'Group' when I make the measure. The 'Sheet2$' is not connected to 'Group' - I guess that is the problem? I cannot connect them as the group in the 'Group' is a calculated measure.

Xilitor01_0-1654849454966.png

 

Hi @Anonymous 

Did you create the table Group? If not, you need to create it first.  'Sheet2$' does not need to connect to 'Group'

vxiaotang_0-1654853442991.png

 

Best Regards,

Community Support Team _Tang

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

Anonymous
Not applicable

Hello,

Yes I did:

Xilitor01_0-1654853609912.png

 

Where:

- Procentgruppe = Group

- 4_FEATURIZ_SOMMERHUSUDLEJNINGER = Sheet2$

Xilitor01_1-1654853627382.png

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.