cancel
Showing results for
Did you mean:
New Member

## Average between summarized values

Hi, I am sorry for the newbie question but I am running into errors trying to calculate the average between the values in two matrices.

I understand that I need to build a relationship between the two tables with the names. However, I do not understand how I can access the summarized values by month. Would I need to create a new column?

I basically want to create a table that shows the average per person per month of the units specified. Also, the second table I was provided, the column names are in Text format and not formatted as Date. When I change it, the true values change. These are not the real values, just fake data to give an idea. Thank you so much for the help! if somebody could point me into the right direction

1 ACCEPTED SOLUTION
Community Support

Hi  @chrisb80 ,

Here are the steps you can follow：

Summarized values by month

1. Convert the [Date] of the table Date2 to Date/Time format by selecting Column tools.

2. Create calculated column.

``Formatted_Date = Format('Data 2'[Date], "YYYY-MM")``

3. Create calculated table.

``````Slice =
SELECTCOLUMNS('Data 1',"Slice",'Data 1'[Formatted_Date])``````

4. Create measure.

``````Measure =
var _1=SELECTEDVALUE('Slice'[Slice])
var _2=CALCULATE(SUM('Data 1'[Unit]),FILTER(ALL('Data 1'),'Data 1'[Formatted_Date]=_1))
var _3=CALCULATE(SUM('Data 2'[Unit]),FILTER(ALL('Data 2'),'Data 2'[Formatted_Date]=_1))
return
_2+_3``````

5. Select [Slice] of the table Slice as the slicer, and place [measure] in Card.

6. Result：

Shows the average per person per month of the units specified:

1. Create calculated table.

``Table = UNION('Data 1','Data 2')``

2. Place [Formatted_Date] of Table to Rows, [Name] to Columns, and [Unit] to Values.

3. Set [Unit] to Average

4. Result.

Best Regards,

Liu Yang

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

2 REPLIES 2
Community Support

Hi  @chrisb80 ,

Here are the steps you can follow：

Summarized values by month

1. Convert the [Date] of the table Date2 to Date/Time format by selecting Column tools.

2. Create calculated column.

``Formatted_Date = Format('Data 2'[Date], "YYYY-MM")``

3. Create calculated table.

``````Slice =
SELECTCOLUMNS('Data 1',"Slice",'Data 1'[Formatted_Date])``````

4. Create measure.

``````Measure =
var _1=SELECTEDVALUE('Slice'[Slice])
var _2=CALCULATE(SUM('Data 1'[Unit]),FILTER(ALL('Data 1'),'Data 1'[Formatted_Date]=_1))
var _3=CALCULATE(SUM('Data 2'[Unit]),FILTER(ALL('Data 2'),'Data 2'[Formatted_Date]=_1))
return
_2+_3``````

5. Select [Slice] of the table Slice as the slicer, and place [measure] in Card.

6. Result：

Shows the average per person per month of the units specified:

1. Create calculated table.

``Table = UNION('Data 1','Data 2')``

2. Place [Formatted_Date] of Table to Rows, [Name] to Columns, and [Unit] to Values.

3. Set [Unit] to Average

4. Result.

Best Regards,

Liu Yang

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

Super User II

Hey @chrisb80 ,

I have to admit that I do not fully understand your requirement, but nevertheless maybe this article Budget – DAX Patterns provides some ideas, it describes how to gain insight from data based on different granularity.

Next to that, it's also a best practice to use a dedicated calendar table, that contains all the necessary columns like date (connected to data 1) and month column in data 2.

Hopefully, this provides some ideas on how to tackle your challenge.

Regards,

Tom

Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Announcements

#### 2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.