cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
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"))))))).

Super User

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.

Super User

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.

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.