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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Rygaard
Resolver I
Resolver I

Calculate less than selectedvalue (CALCULATE(['Actual],'G/L Account'[A.No]<SELECTEDVALUE()

The problem:

CM1=CALCULATE(['Actual],'G/L Account'[A.No]<SELECTEDVALUE(Ark1[konto]))   - NOT workding
CM1=CALCULATE(['Actual],'G/L Account'[A.No]<21000) - Working

 

 

I have a messure that works just fine:

CM1=CALCULATE(['Actual],'G/L Account'[A.No]<21000)

and another
CM2=CALCULATE(['Actual],'G/L Account'[A.No]<27000)
 
instead of making cm1, cm2, Ebit, Ebitda, and and so on i wanted it dynamic so i made  a table
NAME KONTO
Cm1  21000
cm2   27000
Ebit   50000
EBITDA  45000
......
 
if i make a slicer and select CM1   and write a measure like
Selected Account= SELECTEDVALUE(Ark1[konto])    and stick that on  a Card i get 21.000  - Perfect
 
But if i try to use that as a filter it wont work
 
CM1=CALCULATE(['Actual],'G/L Account'[A.No]<SELECTEDVALUE(Ark1[konto]))   - NOT workding
CM1=CALCULATE(['Actual],'G/L Account'[A.No]<21000) - Working
 
i get the error :" A functil ' SELECTEDVALUE' has been used in a True/false expression, that is used as a table filter expression, this is not allowed."
 
Any sugestions on how to make this work ?
 
 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Rygaard , Try like

 

CM1=CALCULATE([Actual],filter('G/L Account','G/L Account'[A.No]<SELECTEDVALUE(Ark1[konto])))

 

or

 

CM1=
var _1 = SELECTEDVALUE(Ark1[konto])
return
CALCULATE([Actual],filter('G/L Account','G/L Account'[A.No]<_1))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Rygaard , Try like

 

CM1=CALCULATE([Actual],filter('G/L Account','G/L Account'[A.No]<SELECTEDVALUE(Ark1[konto])))

 

or

 

CM1=
var _1 = SELECTEDVALUE(Ark1[konto])
return
CALCULATE([Actual],filter('G/L Account','G/L Account'[A.No]<_1))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

#imstupid  the main reason it did not work was ofc. that i made a connection between my selection table and the Acount table -  witch ofc applyed the selection across all calculations.. after i removed that it worked as it should... 

@amitchandak 

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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