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

Current and Previous Period Columns based on Slicer selection -&- Remove Subtotals from Text Columns

I created some sample data (files linked below) of something I could use some help on. I would like to create a "Current Period" column, "Previous Period" column, and a "Difference" column. I'd also like a dropdown slicer to filter specifically on year, quarter, or month, and have the "Previous Period" column update accordingly based on the slicer selection. 

 

Furthermore, how do I prevent subtotals from appearing on text columns? As you can see in the screenshot below, I'm getting a text total of "1111" and "Atlanta", but the amount column totals correctly.

 

Screenshot.png

 

.pbix and .xlsx can be found at: Google Drive Link 

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Two method:

 

Method 1: Create measures for text columns.

CostCenter Measure =
IF (
    ISFILTERED ( 'Employee Expenses'[CCOwnerVP] ),
    MAX ( 'Employee Expenses'[CostCenter] )
)
CostCenterDescription Measure =
IF (
    ISFILTERED ( 'Employee Expenses'[CCOwnerVP] ),
    MAX ( 'Employee Expenses'[CostCenterDescription] )
)
Date Measure =
IF (
    ISFILTERED ( 'Employee Expenses'[CCOwnerVP] ),
    MAX ( 'Employee Expenses'[Date] )
)

 

Then replace your text columns with the measures above.

measure.JPG

 

 

Method 2: use buttons to cover the subtotals not needed.

cover.gif

 

BTW, .pbix file attached.

 

 

 

View solution in original post

3 REPLIES 3
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Two method:

 

Method 1: Create measures for text columns.

CostCenter Measure =
IF (
    ISFILTERED ( 'Employee Expenses'[CCOwnerVP] ),
    MAX ( 'Employee Expenses'[CostCenter] )
)
CostCenterDescription Measure =
IF (
    ISFILTERED ( 'Employee Expenses'[CCOwnerVP] ),
    MAX ( 'Employee Expenses'[CostCenterDescription] )
)
Date Measure =
IF (
    ISFILTERED ( 'Employee Expenses'[CCOwnerVP] ),
    MAX ( 'Employee Expenses'[Date] )
)

 

Then replace your text columns with the measures above.

measure.JPG

 

 

Method 2: use buttons to cover the subtotals not needed.

cover.gif

 

BTW, .pbix file attached.

 

 

 

Anonymous
Not applicable

Thank you so much for the help @Icey !

Anonymous
Not applicable

I updated my .pbix file on Google Drive as I realized my slicer needed to be on a Calendar Table with continuous dates. I also created two measures, shown below.

Previous Period = CALCULATE(
SUM('Employee Expenses'[Amount]),
SAMEPERIODLASTYEAR(CalendarTbl[Date]))
 
Difference = CALCULATE(Sum('Employee Expenses'[Amount])-[Previous Period])
 
I still have not figured out how to remove subtotals from text columns.

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.

Top Solution Authors