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
cottrera
Post Prodigy
Post Prodigy

DAX Average & Model issue

Hi 

 

I am trying to visualise the average repairs spend for all properties in a visual table. I would like to still see the property that have no repairs. Also when I filter the types of repairs. I still which to see all the properties and only the avg spend result change

hope I have explained that ok

 

I have a model that contains 2 tables. Tabe 1 = Properties. In the example below there are 5 properties (one property per row)

Property RefProperty TypeBuilt Year
1House2003
2Flat1985
3House1971
4Flat1955
5House2003

 

Table 2 = Repairs (Many repairs per property)

Property RefTradeSpend over 5 years
1Plumbing£1,010
1Brick£802
2Electrical£332
2Roof£744
2Plumbing£982
2Plumbing£624
3Brick£1,026
3Electrical£785
3Plumbing£892
5Brick£977
5Brick£47
5Plumbing£1,142
5Electrical£687
5Electrical£1,115
5Brick£480

 

I have 2 measures

 

Spend := SUM(Repairs[Spend over 5 years])

 

Average Spend =AVERAGEX(VALUES(Property'[Property Ref] ),
  DIVIDE([Spend],5))   // Avg spend over 5 years

The model looks like this

cottrera_0-1631260416309.png

 

The first issue is when I display the results in a visual table the property that has no repairs / spend information is missing (Property Ref 4)  I need to see this row but with £0

cottrera_1-1631260478303.png

The second issue is that when I filter the table visual by Trade (Repairs table) the properties that do not contain repairs with this type of trade dissapear.

cottrera_2-1631260675749.png

What I would expect to see firstly would be this

Property RefProperty TypeBuilt YearSpendAverage Spend
1House2003£1,812£362.40
2Flat1985£2,682£536.40
3House1971£2,703£540.60
4Flat1955  
5House2003£4,448£889.60

 

And when I filter by trade I would expect to see this

Property RefProperty TypeBuilt YearSpendAverage Spend
1House2003  
2Flat1985£332£66.4
3House1971£785£157
4Flat1955  
5House2003£1802£360.4

 

thanks

Richard

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

Spend = SUM( REPAIRS[Spend over 5 years] ) + 0

Screenshot 2021-09-10 145033.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

2 REPLIES 2
cottrera
Post Prodigy
Post Prodigy

Thank you   

CNENFRNL
Community Champion
Community Champion

Spend = SUM( REPAIRS[Spend over 5 years] ) + 0

Screenshot 2021-09-10 145033.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

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.