cancel
Showing results for
Did you mean:
Highlighted
Member

## How to write DAX statement using where condition

Here is the visual of power BI report shown below for summary table.

The Actual, budget values are summing up for Sales, Cost of Sales, Gross Profit in % of Sales.

But I am looking for an average of values for Report Parameter "Gross Profit in % of Sales".

How to write the DAX formula for a new measured Value (which summarizes Sales, Cost of Sales, and averages Gross profit in % of Sales)

PS: The Report parameter is varchar type, Sales are in decimal type.

Any help will be appreciated, thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Member

## Re: How to write DAX statement using where condition

Looks like your column in Level 2 has 3 values, and you are using just 1 measure.

You cannot change the measure properties of 1 of the row values. (To show 2  rows as sum and one row as percentage)

4 REPLIES 4
Member

## Re: How to write DAX statement using where condition

Have you tried "Percentage of Grandtotal" ?

Member

## Re: How to write DAX statement using where condition

@yash1105, Yes when I try using show value as percentage of grand total, the other parameters (Sales, Cost of Sales) are changing as well.

Member

## Re: How to write DAX statement using where condition

Looks like your column in Level 2 has 3 values, and you are using just 1 measure.

You cannot change the measure properties of 1 of the row values. (To show 2  rows as sum and one row as percentage)

Community Support Team

## Re: How to write DAX statement using where condition

Assume your dataset is like this

Then create a new measure to calculate an average of values for Report Parameter "Gross Profit in % of Sales".

`Measure 2 = IF(MAX([cater])="Gross profit in % of sales",AVERAGEX(ALL(Sheet1),[Measure]),[Measure])`

Best Regards

Maggie

Announcements

#### Back to School Contest

Engage and empower students with Power BI!

#### Watch Sessions On Demand!

Continue your learning in our online communities.

#### Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

#### PBI Community Highlights

Check out what's new in the Power BI Community!

Top Ideas
Top Kudoed Authors
Users Online
Currently online: 330 members 3,687 guests
Recent signins: