Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Jeff_Ng
Frequent Visitor

Filter a table to return a table with distinct id.

How can I transform below the "Input Table" to look like the "Output Table" using DAX in Powe BI?

 

First I need to retrieve maximum number from each 'risk_score_X' then sum them up to produce 'Max_total_score' then return a single row for each 'project_id'. 

 

Your helps will be very much appreciated. Thanks.

 

Input Table    
project_idrisk_score_1risk_score_2risk_score_3risk_score_4total_score
20AB12310012
20AB12302103
20AB12311305
20AB12301045
30AB45610012
30AB45602103
30AB45611507
30AB45601056
      
      
Output Table    
project_idMax_of_risk_score_1Max_of_risk_score_2Max_of_risk_score_3Max_of_risk_score_4Max_of_total_score
20AB123123410
30AB456125513
1 ACCEPTED SOLUTION
shinnes
Frequent Visitor

Hello,

 

I am no expert, but how about something like this:

 

Summarized =
ADDCOLUMNS (
SUMMARIZE (
Table1,
Table1[project_id],
"Max_of_risk_score_1", CALCULATE ( MAX ( Table1[risk_score_1] ) ),
"Max_of_risk_score_2", CALCULATE ( MAX ( Table1[risk_score_2] ) ),
"Max_of_risk_score_3", CALCULATE ( MAX ( Table1[risk_score_3] ) ),
"Max_of_risk_score_4", CALCULATE ( MAX ( Table1[risk_score_4] ) )
),
"total_score", [Max_of_risk_score_1] + [Max_of_risk_score_2]
+ [Max_of_risk_score_3]
+ [Max_of_risk_score_4]
)

 

Perhaps someone else can recommend a simpler way to do.

View solution in original post

2 REPLIES 2
shinnes
Frequent Visitor

Hello,

 

I am no expert, but how about something like this:

 

Summarized =
ADDCOLUMNS (
SUMMARIZE (
Table1,
Table1[project_id],
"Max_of_risk_score_1", CALCULATE ( MAX ( Table1[risk_score_1] ) ),
"Max_of_risk_score_2", CALCULATE ( MAX ( Table1[risk_score_2] ) ),
"Max_of_risk_score_3", CALCULATE ( MAX ( Table1[risk_score_3] ) ),
"Max_of_risk_score_4", CALCULATE ( MAX ( Table1[risk_score_4] ) )
),
"total_score", [Max_of_risk_score_1] + [Max_of_risk_score_2]
+ [Max_of_risk_score_3]
+ [Max_of_risk_score_4]
)

 

Perhaps someone else can recommend a simpler way to do.

Really appreciate your help Sinnes. You are absolutely genius. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.