Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
HI
I can't think how to create new table by using DAX formula.
TableA
Category | Charge |
A | 3 |
B | 4 |
C | 2 |
D | 1 |
TableB
Index |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
I wanto to create the NewTable
Result
Index | Category |
1 | A |
2 | A |
3 | A |
4 | B |
5 | B |
6 | B |
7 | B |
8 | C |
9 | C |
10 | D |
Could you help me ?
Solved! Go to Solution.
Hi, @ChoiJunghoon
Please check the below picture and the sample pbix file's link down below.
Result Table =
VAR rankAaddcolumn =
ADDCOLUMNS ( TableA, "@rankcategory", RANKX ( TableA, TableA[Category],, ASC ) )
VAR cumulateaddcolumn =
ADDCOLUMNS (
rankAaddcolumn,
"@cumulatemax",
SUMX (
FILTER ( rankAaddcolumn, [@rankcategory] <= EARLIER ( [@rankcategory] ) ),
TableA[Charge]
)
)
VAR cumulateaddcolumnstep2 =
ADDCOLUMNS (
cumulateaddcolumn,
"@cumulatemin",
SUMX (
FILTER ( cumulateaddcolumn, [@rankcategory] = EARLIER ( [@rankcategory] ) - 1 ),
[@cumulatemax]
)
)
VAR addtoindexcolumn =
ADDCOLUMNS (
TableB,
"Category",
SUMMARIZE (
FILTER (
cumulateaddcolumnstep2,
[@cumulatemin] < TableB[Index]
&& [@cumulatemax] >= TableB[Index]
),
TableA[Category]
)
)
RETURN
addtoindexcolumn
https://www.dropbox.com/s/voz6y9o9e04cht3/choijunghoon.pbix?dl=0
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi, @ChoiJunghoon
Please check the below picture and the sample pbix file's link down below.
Result Table =
VAR rankAaddcolumn =
ADDCOLUMNS ( TableA, "@rankcategory", RANKX ( TableA, TableA[Category],, ASC ) )
VAR cumulateaddcolumn =
ADDCOLUMNS (
rankAaddcolumn,
"@cumulatemax",
SUMX (
FILTER ( rankAaddcolumn, [@rankcategory] <= EARLIER ( [@rankcategory] ) ),
TableA[Charge]
)
)
VAR cumulateaddcolumnstep2 =
ADDCOLUMNS (
cumulateaddcolumn,
"@cumulatemin",
SUMX (
FILTER ( cumulateaddcolumn, [@rankcategory] = EARLIER ( [@rankcategory] ) - 1 ),
[@cumulatemax]
)
)
VAR addtoindexcolumn =
ADDCOLUMNS (
TableB,
"Category",
SUMMARIZE (
FILTER (
cumulateaddcolumnstep2,
[@cumulatemin] < TableB[Index]
&& [@cumulatemax] >= TableB[Index]
),
TableA[Category]
)
)
RETURN
addtoindexcolumn
https://www.dropbox.com/s/voz6y9o9e04cht3/choijunghoon.pbix?dl=0
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
User | Count |
---|---|
57 | |
22 | |
21 | |
19 | |
16 |
User | Count |
---|---|
87 | |
87 | |
52 | |
37 | |
23 |