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
LucaUSA50
Frequent Visitor

Aggregation of calculated field

Hello everybody,

 

I am using power pviot to analyze data about daily stock (daily inventory level).

The input are the month opening inventory and the daily inventory movements.

Inventory at day x is given by a calculated field:

 

calculate(sum(Main_Analys_Matrix[M15]),DATESMTD(DATEADD(Main_Analys_Matrix[Date],-1,day)))

+0

+calculate(sum(Main_Analys_Matrix[Opening_SAP_D_1]),DATESMTD(DATEADD(Main_Analys_Matrix[Date],0,day)))

 

The first calculate sum the opening inventory up to the day x (opening inventory has a value at day 1 of the month and zero the others day)

The second calculate sum the inventory movements up to the day x

+0 is just a trick to have zero instead no value in the pivot tables

 

Formula works, and caluculate the daily inventory.

 

 

Now I would like to calculate the month average of this caluculated field (in order to add a orizontal line in the charts). I tried various formulas but I could not meet my objetive (SUMX, AVERAGEX, CALCULATE seems don't work if they act on a calculated field).

 

Do you have any suggetions?.

 

Thanks

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@LucaUSA50,

 

Try to add ALLSELECTED Function in your formula.

https://community.powerbi.com/t5/Desktop/Incorrect-matrix-row-total/m-p/287567#M126498

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@LucaUSA50,

 

Try to add ALLSELECTED Function in your formula.

https://community.powerbi.com/t5/Desktop/Incorrect-matrix-row-total/m-p/287567#M126498

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks

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.