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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
manubk
Helper I
Helper I

Average of Two columns by adding the second Column First row to the First Column

Hi Team,

 

I tried differet ways to get Average for the below data but was not possible to get the Dax foumula. Could some one help me in cracking this problem.

 

I have two columns named Checking as First column and First date Min as Second Column.

 

Problem - I need to get average by  considering the  First date Min column first row data in Checking column

 

Below is the example 

 

manubk_0-1739792347786.png

  

manubk_1-1739792372717.png

 

 

It need to get average as below 

 

manubk_3-1739792489335.png

2 ACCEPTED SOLUTIONS

Hi,

Thanks for the solution freginier  and MFelix  offered, and i want to offer some more information for user to refer to.

hello @manubk , you can refer to the follwing solution.

Sample data:

vxinruzhumsft_0-1739849250595.png

 

Create a measure

MEASURE =
VAR a =
    CALCULATETABLE (
        DISTINCT ( 'Table'[First date min] ),
        FILTER ( ALLSELECTED ( 'Table' ), [End MY] IN VALUES ( 'Table'[End MY] ) )
    )
VAR b =
    SELECTCOLUMNS (
        FILTER ( ALLSELECTED ( 'Table' ), [End MY] IN VALUES ( 'Table'[End MY] ) ),
        "Test", [Chencking]
    )
RETURN
    AVERAGEX ( UNION ( a, b ), [First date min] )

Then create a measure and put the following field to it.

vxinruzhumsft_1-1739849423362.png

 

Output

vxinruzhumsft_3-1739849451475.png

 

 

Best Regards!

Yolo Zhu

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

@v-xinruzhu-msft  Thank you soo much.. This is how i wanted the soultion.. Big kudos to you 

View solution in original post

5 REPLIES 5
manubk
Helper I
Helper I

@MFelix @freginier  Thank you so much for your reply .. I just need the Average as below.. there is one more coulmn which indicates the month as End MY as shown below. The average needs to consider based on month. Giving you 3 examples  

 

Jan Month 

manubk_0-1739805041167.png    manubk_1-1739805119765.png

Should receive average as below 

 

manubk_6-1739805281996.png

 

 

December Month 

 

manubk_2-1739805166621.pngmanubk_3-1739805184018.png

Should be 

manubk_7-1739805340924.png

 

 

November Month 

 

manubk_4-1739805221003.png manubk_5-1739805242531.png

 

manubk_8-1739805450762.png

 

 

 

 

 

Hi,

Thanks for the solution freginier  and MFelix  offered, and i want to offer some more information for user to refer to.

hello @manubk , you can refer to the follwing solution.

Sample data:

vxinruzhumsft_0-1739849250595.png

 

Create a measure

MEASURE =
VAR a =
    CALCULATETABLE (
        DISTINCT ( 'Table'[First date min] ),
        FILTER ( ALLSELECTED ( 'Table' ), [End MY] IN VALUES ( 'Table'[End MY] ) )
    )
VAR b =
    SELECTCOLUMNS (
        FILTER ( ALLSELECTED ( 'Table' ), [End MY] IN VALUES ( 'Table'[End MY] ) ),
        "Test", [Chencking]
    )
RETURN
    AVERAGEX ( UNION ( a, b ), [First date min] )

Then create a measure and put the following field to it.

vxinruzhumsft_1-1739849423362.png

 

Output

vxinruzhumsft_3-1739849451475.png

 

 

Best Regards!

Yolo Zhu

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

 

@v-xinruzhu-msft  Thank you soo much.. This is how i wanted the soultion.. Big kudos to you 

freginier
Solution Sage
Solution Sage

Hey there! 

 

To calculate the average for the dataset, try using this DAX function: AverageValue =
VAR FirstRowValue = FIRSTNONBLANK( TableName[Checking], 1 )
VAR TotalSum = SUM( TableName[Checking] ) + FirstRowValue
VAR TotalCount = COUNT( TableName[Checking] ) + 1
RETURN
TotalSum / TotalCount

 

Hope it works!

Zoe 😁😁

MFelix
Super User
Super User

Hi @manubk ,

 

How do you have this two columns in terms of the model? Do you only want to get the average value or do you also need to get the lines as you show in the image?

 

Can you give a litle bit more context on the way the data is setup please.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors