cancel
Showing results for
Did you mean:
Anonymous
Not applicable

Calculate measure turns out Blank and ALL does not work

I would like to calculate my margin of the current year and devide it with the amount of customers without a date filter.

I have tried:

Margin = (Calculate(SUM(Table[Margin]);Table[Date]=YEAR(TODAY()))/(DISTINCTCOUNT(Table[Customer]))

However this turns out with "(BLANK)"

I have tried:

Margin = SUM(Table[Margin]/CALCULATE(DISTINCTCOUNT(Table[Cusomter];ALL(Table[Cusomter]))

And use visual level relative date filter: Is in this Year

However it still does not counts all the customers from before 2018.

What do I have to change in this formulas?

Regards,

Guido

1 ACCEPTED SOLUTION

Accepted Solutions
Member

Re: Calculate measure turns out Blank and ALL does not work

Ok, for that, this works

Margin divided by total count of customers  =
DIVIDE (
SUM ( MarginTable[MarginSum] ),
CALCULATE ( DISTINCTCOUNT ( MarginTable[Customer] ), ALL ( MarginTable[Date] ) )
)

The denomitor is not affected by the date columns now.

See the dummy table I created and the result table

4 REPLIES 4
Member

Re: Calculate measure turns out Blank and ALL does not work

Try this

Measure =
DIVIDE ( SUM ( 'Table'[Margin] ); DISTINCTCOUNT ( 'Table'[Customer] ) )

Then drag the date field into the canvas and create a date slicer like so

You have your dates and the average margin per customer.

Anonymous
Not applicable

Re: Calculate measure turns out Blank and ALL does not work

It still does not return the preferred outcome.

When I add a slicer or filter the visual with a date column it will have affect on both the Sum of margin and the count of customers.

However, the date must only apply on the margin and not on the customer count.

Member

Re: Calculate measure turns out Blank and ALL does not work

Ok, for that, this works

Margin divided by total count of customers  =
DIVIDE (
SUM ( MarginTable[MarginSum] ),
CALCULATE ( DISTINCTCOUNT ( MarginTable[Customer] ), ALL ( MarginTable[Date] ) )
)

The denomitor is not affected by the date columns now.

See the dummy table I created and the result table

Super User

Re: Calculate measure turns out Blank and ALL does not work

Hi,

Does this work?

Margin = SUM(Table[Margin])/CALCULATE(DISTINCTCOUNT(Table[Cusomter]);ALL(Calendar))

Calendar is a Table with running dates.  In that Table, create Year and Month columns.  Create a relatioship between the Date column of the base data table to the Date column of the Calendar Table.  In the filter section, drag year from the Calendar Table.

Announcements

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Get your latest community news and announcements.

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Top Kudoed Authors
Users Online
Currently online: 38 members 1,039 guests
Recent signins: