Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi forum,
I have a question to you regarding following scenario:
Table Dim_SKR4_Account_Group contains financial account groups, defined by ranges.
Dim_SKR4_Chart_of_Accounts contains all accounts (unique):
To relate both, I want to create following mapping table Mapp_Populated_Account_Range:
As you can see, DAX doesnt apply the boundaries.
Therefore I get duplicates.
I worked with CALENDAR() before and didnt face this problem.
I thought GENERATESERIES would work in a similar way.
Is there a way to fix the DAX code or do I have to choose a workaround?
Before this mapping logic was implemented via conditional merge in PQ, but I want to do it in DAX, if possible.
Many thanks,
DataHero
Solved! Go to Solution.
Hi forum,
I found a solution now for my specific case:
Mapp_Populated_Account_Series =
GENERATE (
SELECTCOLUMNS (
'Dim_SKR4_Account_Group',
"Account lower boundary", Dim_SKR4_Account_Group[KontoNrUntergrenze],
"Account upper boundary", Dim_SKR4_Account_Group[KontoNrObergrenze]
),
GENERATESERIES (
[Account lower boundary],
[Account upper boundary],
1
)
)
When you use GENERATESERIES, attention is to be paid in case you want to rename columns withing this code. DAX can easily loose the context here.
To avoid errors, the code is to be written as for the column “test” in case of renaming.
Mapp_Populated_Account_Series =
GENERATE (
SELECTCOLUMNS (
'Dim_SKR4_Account_Group',
"test", Dim_SKR4_Account_Group[KontoNrUntergrenze],
[KontoNrObergrenze]
),
GENERATESERIES (
[test],
'Dim_SKR4_Account_Group'[KontoNrObergrenze],
1
)
)
)
To avoid problems, I recommend to rename already in PQ.
Hi forum,
I found a solution now for my specific case:
Mapp_Populated_Account_Series =
GENERATE (
SELECTCOLUMNS (
'Dim_SKR4_Account_Group',
"Account lower boundary", Dim_SKR4_Account_Group[KontoNrUntergrenze],
"Account upper boundary", Dim_SKR4_Account_Group[KontoNrObergrenze]
),
GENERATESERIES (
[Account lower boundary],
[Account upper boundary],
1
)
)
When you use GENERATESERIES, attention is to be paid in case you want to rename columns withing this code. DAX can easily loose the context here.
To avoid errors, the code is to be written as for the column “test” in case of renaming.
Mapp_Populated_Account_Series =
GENERATE (
SELECTCOLUMNS (
'Dim_SKR4_Account_Group',
"test", Dim_SKR4_Account_Group[KontoNrUntergrenze],
[KontoNrObergrenze]
),
GENERATESERIES (
[test],
'Dim_SKR4_Account_Group'[KontoNrObergrenze],
1
)
)
)
To avoid problems, I recommend to rename already in PQ.
The problem is that the MIN and MAX are being calculated without any filter or row context. Try
All accounts =
GENERATE (
SELECTCOLUMNS (
Dim_SKR4_Account_Group,
Dim_SKR4_Account_Group[KontoNrUntergrenze],
Dim_SKR4_Account_Group[KontoNrObergrenze]
),
GENERATESERIES (
Dim_SKR4_Account_Group[KontoNrUntergrenze],
Dim_SKR4_Account_Group[KontoNrObergrenze]
)
)
Hi @DataHero
if you only want to link the matching group to each Konto you may try to add a new custom column in Dim_SKR4_Chart_of_Accounts like this:
Gruppe =
CALCULATE(
MIN( Dim_SKR4_Account_Group[Kontengruppe] ),
FILTER( Dim_SKR4_Account_Group, Dim_SKR4_Account_Group[KontoNrUntergrenze] <= Dim_SKR4_Chart_of_Accounts[KontoNr] ),
FILTER( Dim_SKR4_Account_Group, Dim_SKR4_Account_Group[KontoNrObergrenze] >= Dim_SKR4_Chart_of_Accounts[KontoNr] )
)
Hope this helps!
Grüße
Tim
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
55 | |
54 | |
54 | |
37 | |
29 |
User | Count |
---|---|
77 | |
62 | |
45 | |
40 | |
40 |