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

Average of Measures

Hello fantastic community,

I have a table like this:

DateBiomass
31/12/202310
31/01/202412
29/02/202414


As I only have one column of dates, I consider that the biomass at the end of the month is equal to the biomass on the first day of the following month.

Now I have one measure named Initial Biomass:

 

Initial Biomass = 
VAR _day = MIN( 'Date'[Date] )
VAR _previous_day = _day - 1
Var _month_previous_day = MONTH( _previous_day ) 
Var _year_previous_day = YEAR( _previous_day )

VAR _ini_bio_SE_1=
	CALCULATE(
    	SUM( 'Movimentos SE'[Biomass (kg)] ),
    	FILTER(
        	ALL( 'Date'),
        	'Date'[Month Number] = _month_previous_day &&
        	'Date'[Year] = _year_previous_day
	)
)

 


And this is working fine, but now I only want to have the average of visible months, when no month is selected for example:

 

 Nov 23Dec 23Jan 24Feb 24Mar 24Total
Initial Biomass151810121413.8

 

The total should change depending on the visible months.

 

Any help would be highly appreciated!

 

Thank you,

Simao

1 REPLY 1
lbendlin
Super User
Super User

You cannot measure a measure directly. Either materialize it first, or create a separate measure that implements the entire business logic.

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.