Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi
I have a doubt regarding Dax in power bi.
Lets say I have a column called values which contains 10 values.
Values |
2 |
4 |
6 |
8 |
6 |
4 |
2 |
6 |
8 |
4 |
Let's take a variable called subgroup which is entered by user. for example, subgroup = 2. I need all the value in the values column to get grouped by 2 ( subgroup value) and displayed
Row Number | Values | Values |
1 | 2 | 4 |
2 | 6 | 8 |
3 | 6 | 4 |
4 | 2 | 6 |
5 | 8 | 4 |
the above example is for subgroup =2
lets say we have subgroup = 3
Row Number | Values | Values | Values |
1 | 2 | 4 | 6 |
2 | 8 | 6 | 4 |
3 | 2 | 6 | 8 |
4 | 4 | Null | Null |
Since, we have only 10 values. the last two fields should be 0 when the subgroup is 3.
Is it possible to write a dax measure to perform the above operation?
Thanks.
It is possible to create a DAX measure that groups values in a column based on a user-entered subgroup value.
Here's an example of a DAX measure that would accomplish this:
Thanks for the help.
I think the doubt is misunderstood. let me try to put it in the correct way.
Lets have a Table called Values with random numbers.
Values |
2 |
4 |
6 |
8 |
6 |
4 |
2 |
6 |
8 |
4 |
I'm having another table called SubGroup.
Subgroup Size |
2 |
3 |
4 |
5 |
6 |
7 |
Now, this column Subgroup size from Subgroup table is added as a slicer. User selects the subgroup size from which I want to create a dynamic table.
For Example, if the user selects Subgroup Size as '2'.
A new table should be created with three columns (Row number, value 1 and value 2)
Output :
Row Number | Value 1 | Value 2 |
1 | 2 | 4 |
2 | 6 | 8 |
3 | 6 | 4 |
4 | 2 | 6 |
5 | 8 | 4 |
Lets take another example,
if the user selects Subgroup Size as '3'.
A new table should be created with four columns (Row number, value 1,value 2 and value 3).
Output :
Row Number | Value 1 | Value 2 | Value 3 |
1 | 2 | 4 | 6 |
2 | 8 | 6 | 4 |
3 | 2 | 6 | 8 |
4 | 4 | Null | Null |
I hope it is clear from the above 2 examples.
Is it possible to write a Dax formula to create a dynamic table like this?
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
20 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |