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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Shrey03
Regular Visitor

Desired output with help of measure

Hi All,

 

I have below base table:

DateColumn 2Column 3Column 4Column 5
2023-12CMF1200
2023-11CMF1200
2023-12EMF1200
2023-11EMF1204835
2023-10EMF1204835
2023-10CMF12761515454
2023-12DMF1256875888
2023-11DMF12761515454
2023-10DMF1256875888
2023-11DAF1206
2023-10DAF1210035
2023-12DAF121006
2023-10CAF125213335117
2023-12CAF127525265659
2023-11CAF126648062601
2023-11EAF127515265624
2023-12EAF126648062595
2023-10EAF125203335111

 

Aggregated table at backend would look something like this (which is not required in output, mentioned just for reference)

Column 2Column 3Column 4Column 5Cal Col1Cal Col2
CMF12761515454102.94783900
CAF1219386516337715.733048800
DMF12189892723043.4824100
DAF122004776.515300
EMF120967000
EAF1219366516333015.663033500
Total    7705600

 

Required output is to get the Total(7705600) for CalCol2 as measure.

Formula for: 

Cal Col1=Abs(Column 5 - Column 4)*100/Column 4

Cal Col2=Cal Col1 * Column 4

 

PS: If not by aggregation method, any other method which can help achieve the desired result of Total for CalCol2 as 7705600 would be helpful

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

lbendlin_0-1711484335650.png

Measure = 
var a = summarize('Table',[Column 2],[Column 3])
var b = addcolumns(a,"Cal Col1",DIVIDE(abs(CALCULATE(sum('Table'[Column 5]))-CALCULATE(sum('Table'[Column 4])))*100,CALCULATE(sum('Table'[Column 4])),0))
var c = ADDCOLUMNS(b,"Cal Col2",[Cal Col1]*CALCULATE(sum('Table'[Column 4])))
return sumx(c,[Cal Col2])

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

lbendlin_0-1711484335650.png

Measure = 
var a = summarize('Table',[Column 2],[Column 3])
var b = addcolumns(a,"Cal Col1",DIVIDE(abs(CALCULATE(sum('Table'[Column 5]))-CALCULATE(sum('Table'[Column 4])))*100,CALCULATE(sum('Table'[Column 4])),0))
var c = ADDCOLUMNS(b,"Cal Col2",[Cal Col1]*CALCULATE(sum('Table'[Column 4])))
return sumx(c,[Cal Col2])

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.