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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
KayCon
Frequent Visitor

Dax Measure - Average including filter

Morning 

 

I've calulated an avg. value, now I need to create 3 more split by type, I need this to be displayed on one line chart.

 

Can anyone help with the dax formular to add a filter on to this

 

AvgValue = SUM('Details'[Paid]) / SUM('Details'[ZCount])
3 REPLIES 3
KayCon
Frequent Visitor

Thank you for your help - got this error when I tried 

 

 The following syntax error occurred during parsing: Invalid token, Line 2, Offset 50, 'On Street"))))))).

hi @KayCon 

Be careful about unclosing brakets and the DataSlayer's code shall work. Can you make a screenshot of the issue?

Or try a simplified code like this:

AvgType1 = CALCULATE([AvgValue], Details[Type] = "Type1")
AvgType2 = CALCULATE([AvgValue], Details[Type] = "Type2")
AvgType3 = CALCULATE([AvgValue], Details[Type] = "Type3")

 

p.s. please consider @someone, if you seek further suggestions. 

MAwwad
Solution Sage
Solution Sage

 

To create additional measures split by type, you can use the FILTER() function to filter your data based on the value of the type column. Here's an example of a DAX formula that calculates the average value split by type:

 

Copy code
AvgValueType1 = CALCULATE( SUM('Details'[Paid]) / SUM('Details'[ZCount]), FILTER('Details', 'Details'[Type] = "Type1") ) AvgValueType2 = CALCULATE( SUM('Details'[Paid]) / SUM('Details'[ZCount]), FILTER('Details', 'Details'[Type] = "Type2") ) AvgValueType3 = CALCULATE( SUM('Details'[Paid]) / SUM('Details'[ZCount]), FILTER('Details', 'Details'[Type] = "Type3") )
 

Each of these formulas will return the average value for a different type, "Type1", "Type2" and "Type3" respectively, this way you can display them on the same line chart.

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 MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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