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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
danandr87
New Member

Need help with Measure (Average, Summarize)

Hi there,

 

i am quite new to Power Bi and need some helf for a specific measure i want to create.

 

This is my simplified data model:

 

danandr87_0-1645791094186.png

 

I have a Fact Table with the goods issues (GI) und open requirements (RQ) of my stock keeping units with quantity and date. And i have a Date Table linked with the Fact Table. In the Date Table there is a column YYMM which is the combination of year and month. And i have a column PERIOD which indicates the months i want to consider for building the measure.

 

So this is what I want to do now:

 

I want to create a stacked column chart with my open Requirements in the future. And in this chart I want to display a line with the average goods issues per month in the determined time range (months with PERIOD = X). 

 

danandr87_1-1645791920763.png

 

But i have no idea how to create the measure for this ignoring the row/filter context. Can you help me?

 

1 ACCEPTED SOLUTION

Hi @danandr87 ,

 

Try to create a measure like below:

Measure 2 = 
var total = 
CALCULATE([Measure],FILTER(ALL('Table'),'Table'[Period]="X"))
var count_x =CALCULATE(DISTINCTCOUNT('Table'[YYMM]),FILTER(ALL('Table'),NOT(ISBLANK([Measure]))&&'Table'[Period]="X"))
return DIVIDE(total,count_x,0)

Vlianlmsft_0-1646203719518.png

 


Best Regards,
Liang
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

8 REPLIES 8
tamerj1
Super User
Super User

Hi @danandr87 

Try

TOTAL_QTY_GI =
CALCULATE (
[TOTAL_QTY],
FILTER ( DateTable, DateTable[PERIOD] = "X" ),
FactTable[Type] = "GI",

ALL ( DateTable[YYMM] )
)


TOTAL_QTY_RQ =
CALCULATE ( [TOTAL_QTY], FactTable[Type] = "RQ" )

 

Hi tamerj1,

 

thanks for your answer, but this does not meet my requirements.

 

I tried to explane my requirement in the following screenshot. I need the measure described with the red lines and frames. Your supposed measure got me the result in the green frame. 

 

danandr87_0-1645955771455.png

 

 

 

Hi @danandr87 ,

 

Try to create a measure like below:

Measure 2 = 
var total = 
CALCULATE([Measure],FILTER(ALL('Table'),'Table'[Period]="X"))
var count_x =CALCULATE(DISTINCTCOUNT('Table'[YYMM]),FILTER(ALL('Table'),NOT(ISBLANK([Measure]))&&'Table'[Period]="X"))
return DIVIDE(total,count_x,0)

Vlianlmsft_0-1646203719518.png

 


Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@danandr87 
Sorry I misunderstood your requirement.
Try 

NEW MEASURE =
AVERAGEX (
    ALL ( DateTable[YYMM] ),
    CALCULATE ( SUM ( FactTable[QTY] ), FactTable[Type] = "GI" )
)

Still I did not understand the purpose of the DateTable[Period] column. As it looks you did not include with your calculation. You can upload a file with sample insensitive data to WeTransfer for example and share the download link. This way will be able to provide you with much more reliable support.
Thank you!

amitchandak
Super User
Super User

@danandr87 , Create a measure

 

calculate(Averagex(values('Date'[YYMM]), calculate(sum(Table[QTY])) ) , allselected())

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

thanks for this answer, but it doesnt meet my requirement. For calculation of the average I want the quantities aggregated per month, but only for the months with PERIOD = X. But these months are not the months in my chart. So the calcualtion must somehow happen in the background ignoring any row and filter contexts, only considering the SKU as a filtering parameter.

@danandr87
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I don't know how to attach a file to this forum and i am not allowed to upload files into a cloud with my work computer. But i took some screenhots of my simplified data model.

 

danandr87_0-1645799374742.png

 

FactTable:

danandr87_1-1645799430237.png

 

DateTable:

danandr87_2-1645799464367.png

 

This is my requirement:

danandr87_3-1645800472434.png

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.