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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
rwong1
Helper III
Helper III

AVERAGE

Hi,

 

How do I create another table that shows the monthly average of the NFE by month and year?  I then will convert that to a line chart.  Here is the sample data:

 

rwong1_0-1647490168683.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @rwong1 ,

 

Sample data:

vstephenmsft_0-1647847890809.png

 

Here's my solution.

1.Create a YearMonth column and a sort column. The sort column is used to sort the YearMonth column.

YearMonth = FORMAT([Date],"YYYY-MMM")
sort = VALUE(FORMAT([Date],"YYYYMM"))

vstephenmsft_1-1647847970103.png

 

2.Then you can drag the NFE column directly into the table and get the average.

vstephenmsft_2-1647848031176.png

 

3.Or you can create a measure.

Measure = CALCULATE(AVERAGE('Table'[NFE]),ALLEXCEPT('Table','Table'[YearMonth]))

vstephenmsft_3-1647848077497.png

 

The line chart:

vstephenmsft_4-1647848111223.png

 

 

Best Regards,

Stephen Tao

 

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

47 REPLIES 47

What is the DAX syntax that you have for NFE?

It's the below:

 

rwong1_0-1647548782387.png

 

Alright, it is more complex than expected. What is in [Raw Loan Amount] measure (the DAX syntax)?

Sorry.  I stepped out.  Here it is:

 

rwong1_0-1647556714541.png

 

Try this:

AverageNFE = AVERAGE( 'Raw data tables'[amount_6])



It didn't work because these are daily balances which are cumulative.  Is there another way?

Please see below:

rwong1_0-1647558875093.png

If it worked, January's average balance should be 6,067,963.98.

Hi rwong1,

If it is daily accumulation, what kind of monthly average are you looking for?

Eg. If in Jan 2022, daily transaction is 1 dollar. The average for Jan 2022 is 1 dollar even though the sum is $31.

 

Or do you have multiple transactions in a day that needs to be summed?

No if it worked January's average should be 6,067,963.98.  The sum of all those numbers in January is $188,106,883.30.  You take that and divide it by 31 days in January and you get the 6,067,963.98.  I'm trying to get Power Bi to produce monthly average of the NFE columns.  Each day's balance is listed in the NFE column.  

Lets try this:

Create this calculated column in 'Raw data tables'
 
Year-Date = YEAR([Date]) & "-" & FORMAT([Date], "MM")

Then create this measure:
 
AverageNFE =
AVERAGEX(
SUMMARIZE(
'Raw data tables',
'Raw data tables'[Date],
"NFE", 'Raw data tables'[amount_6]
),
[NFE]
)

Your date column could be [Posting Date_1] if it is in the 'Raw data table'

Then plot the table:

Tutu_in_YYC_0-1647561024814.png

 

I can't do the Raw data tables [amount 6].  It won't let me choose it.  Only options are measures within that table.

So you cant create a measure? What tables/columns do you have access to? Thats odda and sounds like there is Object-Level-Security in place or some sort of other limitations

Please see what I was talking about:

 

rwong1_0-1647563039306.png

 

Remove what i have crossed out in the diagram with red ( that includes the last bracket in line 9, there should be only 1 close bracket in line 9)

Tutu_in_YYC_0-1647563292916.png

 

I did that.  It still didn't take.  It's not picking up amount 6 from Raw data tables as that's still underlined.  I don't know why.

my mistake! i missed a function there

 

AverageNFE =
AVERAGEX(
SUMMARIZE(
'Raw data tables',
'Raw data tables'[Date],
"NFE", SUM('Raw data tables'[amount_6])
),
[NFE]
)

 

No it didn't work.  Still showing the wrong average numbers.

 

Screenshot please.

rwong1_0-1647564976616.png

 

I am missing something here, but without knowing more about your data model and the granularity of the tables, it is going to be hard.

If you could replicate a pbix with no sensitive info, I can definitely take a look at it.

Okay let me see how I can do it.  The thing is, it's not the average of that amount_6.  These are cumulative balances per day so the average of amount_6 won't give it to me.  I think the formula has to be mixed in with the CUMULATIVE AMOUNT measure.  I just don't know how to do it.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.