cancel
Showing results for
Did you mean:
Regular Visitor

## Calculate Data using Date Slicer

Hi Everyone,

I don't know if this can be done but here goes nothing. I have a Table that has 2 fields; "Report Date" and "Orig Amount". What I would like to do is do create two more columns - one for Amt Previous that shows all the Original Amount that happened before the begin date of slicer, and the other column is to show all Original Amount that happened during the selected date range of slicer.

In my MS access databased I set it up like this

AmtPrevious: IIf([SubRptDate]<DateValue([TempVars]![varPerBegin]),[FedOrigSubAmt],0)

AmtThisPeriod: IIf([SubRptDate] Between DateValue([TempVars]![varPerBegin]) And DateValue([TempVars]![varPerEnd]),[FedOrigSubAmt],0)

So I'm wondering if I can do the same thing in MS access but this time use the date slicer. Thank you in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: Calculate Data using Date Slicer

You can create two measures and place each of them in a Card visual or both in a multi-row Card visual.

The measure for Amt Previous:

```AmountB4SlicerPeriod =
CALCULATE (
SUM ( Table1[OriginalAmount] );
FILTER (
ALL ( Table1[ReportDate] );
Table1[ReportDate] < MIN ( Table1[ReportDate] )
)
)```

and the other one:

```AmountDuringSlicerPeriod =
SUM(Table1[OriginalAmount])```

Code formatted with

3 REPLIES 3
Super User

## Re: Calculate Data using Date Slicer

You can create two measures and place each of them in a Card visual or both in a multi-row Card visual.

The measure for Amt Previous:

```AmountB4SlicerPeriod =
CALCULATE (
SUM ( Table1[OriginalAmount] );
FILTER (
ALL ( Table1[ReportDate] );
Table1[ReportDate] < MIN ( Table1[ReportDate] )
)
)```

and the other one:

```AmountDuringSlicerPeriod =
SUM(Table1[OriginalAmount])```

Code formatted with

Community Support Team

## Re: Calculate Data using Date Slicer

HI @mbenjelloun,

I think you need to use measure to achieve this, current power bi not support to create dynamic calculated column/tables based on slicer.

Calculated Column/Table Change Dynamically According to Slicer Selection in the Report.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

For learning resources/Release notes, please visit: | |
Regular Visitor

## Re: Calculate Data using Date Slicer

Thank you so much, this works

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: 132 members 1,711 guests
Recent signins: