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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Dynamic Measure based on Filter Selection Direct Query

Hi all,

 

I'm working with direct query to connect SAP BW, I'm unable to use most of features of Power BI because of Direct Query.

Is it possible to create dynamic measure based on filter ?
I mean For ex I have year filter and i have 2 measure like Selected Year and Selected Year -1
if I select 2020 it it must be return 2020 and 2019
if I select 2018 it must be return 2018 and 2017

As you see i can't create table or something like that. Is there anyone have idea ? 
 Screenshot_11.png

Screenshot_2.png

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous,

If you want to achieve selector effect on your records instead of filter, you need to use not connect table(not has relationship to the current table) fields on slicer. Then you can use dax function to extract selected values as a condition to calculate in your measures.

If above not help, please share some dummy data with a similar data structure and expected result to help us clarify your scenario and test to conding formula:

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

amitchandak
Super User
Super User

@Anonymous , In such cases it is better to a separate date/year table

try like

measure =
var _max = maxx(allselected(Date),Date[Year])
return
calculate(sum(Table[Data]), filter(all(Date),Date[Year]<=_max && Date[Year]>=_max-1 ))

 

Otherwise all will remove other filters too

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @amitchandak,

As I write in top, I'm working with bw direct query and I'm unable to create separate table.

Also I'm unable to change type of dimension.

alsasloren_0-1593021567637.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.