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
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
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.