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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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
AlB
Super User
Super User

Hi @Anonymous

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   www.daxformatter.com

 

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

HI @Anonymous,

 

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
If this post helps, please consider accept as solution to help other members find it more quickly.
AlB
Super User
Super User

Hi @Anonymous

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   www.daxformatter.com

 

Anonymous
Not applicable

Thank you so much, this works 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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