Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi all,
I'm working on for a week but I wasn't able to come up with a solution:
The following table is the output of a variable table, where white columns are the original ones (phisical table) while the yellows are virtual columns created with the following measure:
VAR _Table1=
ADDCOLUMNS(
PHISICAL_TABLE,
"@Key",PHISICAL_TABLE[Key Brand]
"@Actual/PlannedPY",
IF(PHISICAL_TABLE[Cluster]="2024-N1" && ISBLANK(PHISICAL_TABLE[Actual/Planned]),
CALCULATE(
MAX (PHISICAL_TABLE[Actual/Planned] ),
FILTER (
PHISICAL_TABLE,
[@Key] = EARLIER ( [@Key] )))))
In reality, I have already achieved the purpose with the measure, that is repeating the number in 4th column for each row with the same @Key but only for the next year (highlighted in yellow)
But when I try to put @Actual/Planned column in a matrix object with SUMX, Actual/Planned values are not displayed correctly.
RETURN
SUMX(_Table1, [@Actual/PlannedPY])
(I would expect to have the value of @Actual/Planned repeated for the corresponding Year and Week (columns of phisical table), not only just the total row)
PS: i need to manage it with virtual tables and columns, so please don't suggest me to calculate it directly into the phisical table.
Thanks in advance!
Luca
@planc7 Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
Thank you for your reply.
Unfortunately I wasn't able to find any solution in the forum.
Anyway, here below the sample of data.
Essentially, I need to create a virtual column (Actual Planned PY) that repeats Actual/Planned number for each row with the same @Key but only for the next year.
I manage it with a measure, and the measure works, but I need to insert the new column (Actual Planned PY) in a matrix, and here is the point where I have the problem
Here the measure used to recreate the Virtual Table and the Column needed (Actual Planned PY)
VAR _Table =
ADDCOLUMNS(
'PHISICAL_TABLE',
"@Key",
IF(NOT ISBLANK(PHISICAL_TABLE[Actual/Planned]),
PHISICAL_TABLE[Year]+1&FORMAT(PHISICAL_TABLE[Week],"00")&'PHISICAL_TABLE'[Brand]&'PHISICAL_TABLE'[Cluster],
PHISICAL_TABLE[Key Brand])
)
VAR _Table1=
ADDCOLUMNS(
_Table,
"@Actual/PlannedPY",
IF(ISBLANK(PHISICAL_TABLE[Actual/Planned]),
CALCULATE(
MAX ( PHISICAL_TABLE[Actual/Planned] ),
FILTER (
_Table,
[@Key] = EARLIER ( [@Key] )))))
RETURN
SUMX(_Table1, [@Actual/PlannedPY])
Year | Week | Brand | Cluster | Key Brand | Actual/Planned | Year&Week | Year+1 |
2023 | 51 | XX | 2024-AA | 202351XX2024-AA | 4 | 202351 | 2024 |
2024 | 51 | XX | 2024-AA | 202451XX2024-AA | 202451 | 2025 | |
2023 | 50 | XX | 2024-AA | 202350XX2024-AA | 4 | 202350 | 2024 |
2024 | 50 | XX | 2024-AA | 202450XX2024-AA | 202450 | 2025 | |
2023 | 49 | XX | 2024-AA | 202349XX2024-AA | 5 | 202349 | 2024 |
2024 | 49 | XX | 2024-AA | 202449XX2024-AA | 202449 | 2025 | |
2023 | 47 | XX | 2024-AA | 202347XX2024-AA | 9 | 202347 | 2024 |
2024 | 47 | XX | 2024-AA | 202447XX2024-AA | 202447 | 2025 | |
2023 | 45 | XX | 2024-AA | 202345XX2024-AA | 12 | 202345 | 2024 |
2024 | 45 | XX | 2024-AA | 202445XX2024-AA | 202445 | 2025 | |
2023 | 44 | XX | 2024-AA | 202344XX2024-AA | 13 | 202344 | 2024 |
2024 | 44 | XX | 2024-AA | 202444XX2024-AA | 202444 | 2025 | |
2023 | 43 | XX | 2024-AA | 202343XX2024-AA | 19 | 202343 | 2024 |
2024 | 43 | XX | 2024-AA | 202443XX2024-AA | 202443 | 2025 | |
2023 | 42 | XX | 2024-AA | 202342XX2024-AA | 17 | 202342 | 2024 |
2024 | 42 | XX | 2024-AA | 202442XX2024-AA | 202442 | 2025 | |
2023 | 41 | XX | 2024-AA | 202341XX2024-AA | 14 | 202341 | 2024 |
2024 | 41 | XX | 2024-AA | 202441XX2024-AA | 202441 | 2025 | |
2023 | 40 | XX | 2024-AA | 202340XX2024-AA | 7 | 202340 | 2024 |
2024 | 40 | XX | 2024-AA | 202440XX2024-AA | 202440 | 2025 | |
2023 | 39 | XX | 2024-AA | 202339XX2024-AA | 10 | 202339 | 2024 |
2024 | 39 | XX | 2024-AA | 202439XX2024-AA | 202439 | 2025 |