1

I have: - a slicer with dates and a table 'Log' with a column 'Date' with dates and a column 'Max' with numbers (e.g. 0,31)

I need to calculate the average of all values in the column 'Max' when the date is before the slicer selection date - and an average for after.

End result: a Card visualisation with the average of all values before the selected date and a Card visualisation with the average of all values after the selected date.

1
  • I think you don't need the calculated column. In you question says you have two, both called Log. Add some sample data and your expected result Commented Sep 7, 2016 at 13:31

2 Answers 2

2

Create three measures:

avg = AVERAGE('Log'[Max])


AverageAfterSelectedDate =
CALCULATE (
    [avg],
    FILTER ( ALL ( 'Log' ), [Date] > MINX ( 'Log', 'Log'[Date] ) )
)


AverageBeforeSelectedDate =
CALCULATE (
    [avg],
    FILTER ( ALL ( 'Log' ), 'Log'[Date] < MINX ( 'Log', [Date] ) )
)

Just use the AverageBeforeSelectedDate and AverageAfterSelectedDate measures in the cards.

For this data:

enter image description here

It produces:

enter image description here

Let me know if this helps.

Sign up to request clarification or add additional context in comments.

3 Comments

I cannot make it work: The formula editor won't let me select the field with the date used in the slicer. I can select fields from the Log table and calculated columns/measures in the SharePoint table (where the slicer date is), but not the field I need. The slicer date is in another table than the Log.
I moved som stuff around and made it work. Thanks a lot :)!
A sidequestion... I have two more slicers active on the same db. These two do not affect the averages at the moment. Is it possible to extend the solution to include more slicers?
0

I had to calculate count of all Accounts that were opened before the selected Slicer Date.

Here is what I ended up doing

TotalAccounts = 
CALCULATE(
      DISTINCTCOUNT(Table1.ID),
           FILTER( 
                    ALL(Table1),MIN(Table2.Date)>Table1.Date)
                 )

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.