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
Anonymous
Not applicable

Clustered column average total

Hi - I have seen some similar posts on this but, being fairly unfamiliar with DAX, I haven't been able to figure out how to translate it into a solution for my problem. 

 

In short, I'm showing a weighted average for tenure by month but I want to show what the average is for the total time period shown in one graph ideally. 

 

I tried to post a screenshot but I'm not sure if it will show up here. It's pretty simple though - I have three months ("month" variable in the axis) each showing with their own value for "weighted tenure" (placed in the value area ). I want to show those three months AND the overall average for the time period. Right now, I'm just creating two bar charts and removing the "months" from the axis so as to get the averaged total. How do I get them on the same graph?

7 REPLIES 7
kentyler
Solution Sage
Solution Sage

This is one of those cases where you will have to write some DAX. 
Using the CALCULATE() function in DAX you can modify the filter context.

So if you have a row showing data for a specific month you can CALUCLATE() the average for the 3 previous months, because CALCULATE allows you to use the ALL() function to temporarily remove the filter context for that row and reset it to consider the whole table, which you can then filter to get the 3 month average.

 

If you'd like some help writing the DAX post a small sample power bi file, or an excel file with a sample of your data.

I'm a personal Power Bi Trainer I learn something every time I answer a question

The Golden Rules for Power BI

  1. Use a Calendar table. A custom Date tables is preferable to using the automatic date/time handling capabilities of Power BI. https://www.youtube.com/watch?v=FxiAYGbCfAQ
  2. Build your data model as a Star Schema. Creating a star schema in Power BI is the best practice to improve performance and more importantly, to ensure accurate results! https://www.youtube.com/watch?v=1Kilya6aUQw
  3. Use a small set up sample data when developing. When building your measures and calculated columns always use a small amount of sample data so that it will be easier to confirm that you are getting the right numbers.
  4. Store all your intermediate calculations in VARs when you’re writing measures. You can return these intermediate VARs instead of your final result  to check on your steps along the way.




Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Anonymous
Not applicable

I created a sample pbix file but it won't let me drag and drop or copy-paste it here. how do I post it?

share via one drive ? google drive ?

 





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Anonymous
Not applicable

this is the chart in the sample tenure.PNG

It looks like this is totaling all the data in the table

are you saying, you would like to get these counts for a specific month's worth of data, and compare it with the total for the previous 3 months ?





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Anonymous
Not applicable

Yeah the sample file I sent is only one day's worth of data so I couldn't show a time comparison but yes what I'm aiming for is to use the weighted tenure average measure you saw there as the value for each month (for three months in this case) and have an additional column that has the overall average for those three months. Ideally, I'd want it to be dynamic, so if I added a fourth month the overall average column would automatically update. If it helps, I can add a day of data to my test file from a different month to better show what I'm looking for. 

Anonymous
Not applicable

Here's a file with two months showing in the graph. i'd want an "overall" data point in here that would be the average of the two and would change as I added or removed months to the graph.

 

https://drive.google.com/open?id=1auuiCQ6hmgu1r7c7WZCEw4NV96Ft99TN

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.