cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper III

## Create New Table with Dax

Hello

I want to create the result table with Dax.
Could you help me ?
TableA

 Catergory Value A 5 B 8 C 12

TableB

 Catergory Charge A 2 B 3 C 4

ResultTable

 Category Number A 6 A 7 B 9 B 10 B 11 C 13 C 14 C 15 C 16
1 ACCEPTED SOLUTION
Solution Sage

``````SELECTCOLUMNS(
GENERATE(
TableA,
var Val = TableA[Value]
var Cat = TableA[Category]
var Chrg =
LOOKUPVALUE(
TableB[Charge],
TableB[Category], Cat,
BLANK()
)
var Nums =
SELECTCOLUMNS(
GENERATESERIES(
Val + 1,
Val + Chrg,
1
),
"@Number", [Value]
)
return
Nums
),
"Category", TableA[Category],
"Number", [@Number]
)``````
3 REPLIES 3
Solution Sage

Another way would be:

``````SELECTCOLUMNS(
GENERATE(
NATURALINNERJOIN(
TableA,
TableB
),
var Val = TableA[Value]
var Cat = TableA[Category]
var Chrg = TableB[Charge]
var Nums =
SELECTCOLUMNS(
GENERATESERIES(
Val + 1,
Val + Chrg,
1
),
"@Number", [Value]
)
return
Nums
),
"Category", TableA[Category],
"Number", [@Number]
)``````
Solution Sage

``````SELECTCOLUMNS(
GENERATE(
TableA,
var Val = TableA[Value]
var Cat = TableA[Category]
var Chrg =
LOOKUPVALUE(
TableB[Charge],
TableB[Category], Cat,
BLANK()
)
var Nums =
SELECTCOLUMNS(
GENERATESERIES(
Val + 1,
Val + Chrg,
1
),
"@Number", [Value]
)
return
Nums
),
"Category", TableA[Category],
"Number", [@Number]
)``````
Helper III

Thank you So much!!