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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
mamal
Frequent Visitor

Using slicer selection in visual with disabled interaction

(updated)
Hi, community

I am trying to calculate some values for selected and previous custom time periods. I have indexed the time periods to be able to match them and managed to identify a previous period with a formula:

 

PreviousPeriodKey = SELECTEDVALUE('PeriodLookup'[PeriodKey])-1

 

When I show this measure on the page with active slicer selection it shows correct value. 
However, when I try to use it in a calculation, regardless whether I save it as a separate measure, or use in VAR, I always get blank result on the very same page.

Here is the measure I am trying to use:

 

Measure = 
SUMX(FILTER('DataTable','DataTable'[PeriodKey] = [PreviousPeriodKey]),'DataTable'[Value])

 

Adding calculate at the beginning as suggested below does not help. The issue is that when I keep the slicer filter active over the visual, the PreviousPeriodKey works well but the measure cannot retrieve data earlier than selected PeriodKey. And when the interaction between slicer and visual is disabled, the SELECTEDVALUE can't work properly.
The idea is to be able to calculate different measures for two consecutive category indexes (PeriodKey in the sample).
I have already checked the format of different columns and the measure itself as well as proper relationships are established between the tables.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @mamal ,

You can update the formula of measure as below and check if it can return the correct result...

Measure =
VAR prepkey =
    SELECTEDVALUE ( 'PeriodLookup'[PeriodKey] ) - 1
RETURN
    SUMX (
        FILTER ( ALLSELECTED ( 'DataTable' ), 'DataTable'[PeriodKey] = prepkey ),
        'DataTable'[Value]
    )

If the above one can't help you get the expected result, please provide some raw data in your table (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @mamal ,

You can update the formula of measure as below and check if it can return the correct result...

Measure =
VAR prepkey =
    SELECTEDVALUE ( 'PeriodLookup'[PeriodKey] ) - 1
RETURN
    SUMX (
        FILTER ( ALLSELECTED ( 'DataTable' ), 'DataTable'[PeriodKey] = prepkey ),
        'DataTable'[Value]
    )

If the above one can't help you get the expected result, please provide some raw data in your table (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

ChandrashekaraD
Frequent Visitor

Can you please try this

Calucate(
SUMX(FILTER('DataTable','DataTable'[PeriodKey] = [PreviousPeriodKey]),'DataTable'[Value]))

Unfortunately, this does not help... I wonder if this might be connected to the fact that I am trying to use a value (PreviousPeriodKey) that is based on slicer selection but in the calculation I am using formulas that might override it?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors