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
Ben_Kronk
Frequent Visitor

Create a filtered average column by combining two measures

I am new to Power BI and I want to create a new column that an average of the total of two other columns.

 

I can create the total using a measure:  TOTAL 1 = DISTINCTCOUNT(Database[Column 1])

 

I can also create the other total: TOTAL 2 = SUM(Database[Column 2])

 

I want to divide the total of TOTAL 2 by TOTAL 1.  But when I do this, I get the average of the entire database.  I want the average of just the table and/or visual that I created using filters.

4 REPLIES 4
v-shex-msft
Community Support
Community Support

Hi @Ben_Kronk,

Unfortunately, current power bi does not support creating a dynamic calculated column/table based on filter/slicer.
When you use measure in the calculated column, these row contents will be fixed to 'whole table' and not able to interact with slicer/filter. 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
amitchandak
Super User
Super User

If interaction is not off and you are not using all in divide it should filter by slicer.

Greg_Deckler
Super User
Super User

You will need a measure then, like this:

Measure = DIVIDE(SUM(Database[Column 2]), DISTINCTCOUNT(Database[Column 1]),0)

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Okay got it.  My final step is take the average measure (.59) and make that number repeat in its own column.

 

Ex.

.88   .59

.47   .59

.24   .59

Etc.

 

My goal is to create a dual axis chart with bars of different heights for each value, and a consistent line across the entire chart - I can create this chart on my own.

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.