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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
MosesDhas
Regular Visitor

Create Measures in matrix format from records in transactional format i.e. top down approach

there is a table like below where files are appended based on sequential revisions.

Table view
FileIdent CodedescpweightRevisionDiscipline
1Ident Code_2 125.560STR
1Ident Code_3  0STR
1Ident Code_4  0STR
FileIdent CodedescpweightRevisionDiscipline
1Ident Code_2 1301STR
1Ident Code_3  1STR
1Ident Code_4  1STR
1Ident Code_5  1STR

 

the output should be like below where for every ident_code the variance between 1st and 0 revision, 2nd and 1st revision should come. if there is a 3rd revision , then dynamically the variance between rev3 and rev 2 should come.

Output
Ident CodeDescipRev 0 WeightVar Rev 1Var Rev 2
Ident_Code_2 125.564.44 

 

any help would be highly appreciated

2 REPLIES 2
v-jiewu-msft
Community Support
Community Support

Hi @MosesDhas ,

Based on my testing, please try the following methods:

1.Create the simple table.

vjiewumsft_0-1715908338350.png

2.Create the new measure to calculate Rev 0 Weight.

Rev 0 Weight = 
VAR Ident_ = SELECTEDVALUE('Table'[Ident Code])
RETURN
CALCULATE(
    SUM('Table'[descp weight]),
    'Table'[Revision] = 0,
    'Table'[Ident Code] = Ident_
)

3.Create the new measure to calculate Variation Rev 1 and Rev 2.

Variation Rev 1 = 
VAR Ident_c = SELECTEDVALUE('Table'[Ident Code])
RETURN
CALCULATE(
    SUM('Table'[descp weight]),
    'Table'[Revision] = 1,
    'Table'[Ident Code] = Ident_c
) - [Rev 0 Weight]
Variation Rev 2 = 
VAR Iden_ = SELECTEDVALUE('Table'[Ident Code])
var result = CALCULATE(
    SUM('Table'[descp weight]),
    'Table'[Revision] = 2,
    'Table'[Ident Code] = Iden_
) - [Variation Rev 1]
RETURN
IF(MAX('Table'[Revision]) = 2, result ,BLANK())

4.Drag two measure into the table visual. The result is shown below.

vjiewumsft_1-1715908356466.png

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

thanks alot for this, however there will be many revisions and the formula should be dynamic to add new revisions and on the table view we should be able to select what revisions need to be displayed.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.