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
Anonymous
Not applicable

Sumx Total Measure

Hi ,

 

I have below dataset

 

KPIActual Value     Program     Region
Material    80       ASouth
Material     70       BSouth
Material     70       CSouth
Number of Sites      1       ASouth
Number of Sites      2       BSouth
Number of Sites      3       CSouth

 

Total Sites =  Σ Material* Number of Sites =SUM(80*1+70*2+70*3)

 

 I want to create Total Sites Measure, not by calculated columns

 

Thanks

 

 

 

 

 

1 ACCEPTED SOLUTION
DataZoe
Employee
Employee

@Anonymous I beleive this is the measure you want:

 

Total Sites = 
sumx(values('Table'[Program]),
CALCULATE(sum('Table'[Actual Value]),'Table'[KPI]="Material")
* CALCULATE(sum('Table'[Actual Value]),'Table'[KPI]="Number of Sites"))

 

 totalsites.JPG

 

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

View solution in original post

7 REPLIES 7
DataZoe
Employee
Employee

@Anonymous I beleive this is the measure you want:

 

Total Sites = 
sumx(values('Table'[Program]),
CALCULATE(sum('Table'[Actual Value]),'Table'[KPI]="Material")
* CALCULATE(sum('Table'[Actual Value]),'Table'[KPI]="Number of Sites"))

 

 totalsites.JPG

 

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

Anonymous
Not applicable

Correct. I m looking for this one

Greg_Deckler
Super User
Super User

@Anonymous - Seems like:

Measure =
  VAR __Table = 
    ADDCOLUMNS(
      SUMMARIZE('Table',[Region],[Program],"Value",SUMX(FILTER('Table',[KPI]="Material"),[Actual Value]),"Number",SUMX(FILTER('Table',[KPI]="Number of Sites"),[Actual Value])),
      "Product",[Value] * [Number]
    )
RETURN
  SUMX(__Table,[Product])

But, I get the feeling that you shouldn't have unpivoted your KPI column...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@Anonymous , pivot this data and try

https://radacad.com/pivot-and-unpivot-with-power-bi
https://youtu.be/oKByyI09Bno

 

then you can multiple

 

Or try a measure like

sumx(summarize(Table, Table[Program],Table[Region], "_1", calculate(sum(Table[Actual Value]), Table[KPI] ="Material" ) * calculate(sum(Table[Actual Value]), Table[KPI] ="Number of Sites" )),[_1])

Anonymous
Not applicable

My requirement is to do without Pivot data.Is there any method do without pivoting?

@Anonymous , try a measure like

sumx(summarize(Table, Table[Program],Table[Region], "_1", calculate(sum(Table[Actual Value]), Table[KPI] ="Material" ) * calculate(sum(Table[Actual Value]), Table[KPI] ="Number of Sites" )),[_1])

Anonymous
Not applicable

image.png

getting this error

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.