cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
RomainTo
Frequent Visitor

CALCULATE with KEEPFILTERS not working when adding constant

Hello 🙂

 

I am facing an issue on my visual.

 

I have created two measures : 

test1 = CALCULATE(Mesures[Encours_1],KEEPFILTERS('Dimension Divers'[devise]="EUR"))
test2 = CALCULATE(Mesures[Encours_1]+10,KEEPFILTERS('Dimension Divers'[devise]="USD"))
 
But as you can see below.. As soon as we add a constant number to the CALCULATE the KEEPFILTERS function is not working.
It puts the value everywhere...
 
RomainTo_0-1666945493515.png

I have do some further testing and it seems that as soon as we do an addition in the CALCULATE then it won't work (but it works for a multiplication !). I have also tried to put the addition after the CALCULATE but same issue..

Do you have any idea ?

 

Thanks for your help.

 

Romain

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Try

test2 =
CALCULATE (
    Mesures[Encours_1]
        + IF ( SELECTEDVALUE ( 'Dimension Divers'[devise] ) = "USD", 10 ),
    KEEPFILTERS ( 'Dimension Divers'[devise] = "USD" )
)

View solution in original post

1 REPLY 1
johnt75
Super User
Super User

Try

test2 =
CALCULATE (
    Mesures[Encours_1]
        + IF ( SELECTEDVALUE ( 'Dimension Divers'[devise] ) = "USD", 10 ),
    KEEPFILTERS ( 'Dimension Divers'[devise] = "USD" )
)

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors