Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Just wondering if there is an alternative in PIVOT inside power query by using DAX?
I know using PIVOT inside PQ is so much easier.
Just wanna know if there's another approach to come up with the desired result. 🙂
Originally my table looks like this
the expected output below w/c I was able to achieve by using pivot.
Solved! Go to Solution.
@v_mark there certainly is (if there number of pivoted columns are known in advance). See screenshot and code below. Note: this is a new table which needs to be created
Regards,
Moiz
If this post helps, please "Accept" it as Solution to help other members find it.
SampleDataPivoted =
SUMMARIZE (
SampleData,
SampleData[ParentPublicID],
"Status", MIN ( SampleData[Status] ),
"Status_1", MIN ( SampleData[Status_1] ),
"Diagnosis",
CALCULATE (
MIN ( SampleData[TaskID] ),
FILTER (
SampleData,
SampleData[Title] = "Diagnosis"
&& SampleData[ParentPublicID] = [ParentPublicID]
)
),
"Repair",
CALCULATE (
MIN ( SampleData[TaskID] ),
FILTER (
SampleData,
SampleData[Title] = "Repair"
&& SampleData[ParentPublicID] = [ParentPublicID]
)
),
"Recovery",
CALCULATE (
MIN ( SampleData[TaskID] ),
FILTER (
SampleData,
SampleData[Title] = "Recovery"
&& SampleData[ParentPublicID] = [ParentPublicID]
)
),
"Testing",
CALCULATE (
MIN ( SampleData[TaskID] ),
FILTER (
SampleData,
SampleData[Title] = "Testing"
&& SampleData[ParentPublicID] = [ParentPublicID]
)
)
)
Hi @v_mark ,
Does the replies above solve your problem? If it has been solved, please mark the correct reply as the standard answer to help the other members find it more quickly.Thank you very much for your kind cooperation!
Hope it helps,
Community Support Team _ Caitlyn
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
@v_mark there certainly is (if there number of pivoted columns are known in advance). See screenshot and code below. Note: this is a new table which needs to be created
Regards,
Moiz
If this post helps, please "Accept" it as Solution to help other members find it.
SampleDataPivoted =
SUMMARIZE (
SampleData,
SampleData[ParentPublicID],
"Status", MIN ( SampleData[Status] ),
"Status_1", MIN ( SampleData[Status_1] ),
"Diagnosis",
CALCULATE (
MIN ( SampleData[TaskID] ),
FILTER (
SampleData,
SampleData[Title] = "Diagnosis"
&& SampleData[ParentPublicID] = [ParentPublicID]
)
),
"Repair",
CALCULATE (
MIN ( SampleData[TaskID] ),
FILTER (
SampleData,
SampleData[Title] = "Repair"
&& SampleData[ParentPublicID] = [ParentPublicID]
)
),
"Recovery",
CALCULATE (
MIN ( SampleData[TaskID] ),
FILTER (
SampleData,
SampleData[Title] = "Recovery"
&& SampleData[ParentPublicID] = [ParentPublicID]
)
),
"Testing",
CALCULATE (
MIN ( SampleData[TaskID] ),
FILTER (
SampleData,
SampleData[Title] = "Testing"
&& SampleData[ParentPublicID] = [ParentPublicID]
)
)
)
You should be able to use a Matrix visual to achieve this. Put ParentPublicID, Status and Status_1 as rows, Title as columns and TaskID as values.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
94 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |