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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
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

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 

all customers tables.PNG

 

 

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Yggdrasill
Responsive Resident
Responsive Resident

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

Capture.PNG

 

 

 

 

You have your dates and the average margin per customer.

 

 

 

Anonymous
Not applicable

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. 

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 

all customers tables.PNG

 

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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