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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Laiq_Rahman
Helper I
Helper I

summarize table using direct query based on slicer isn't working

Hi,

 

I'm connecting to fabric warehouse through symantic layer (direct query option). I've a Dim_date and fact_bid_offer where it had relationship as below.

Laiq_Rahman_0-1712274052053.png

I've a date slicer as below on the report view.

Laiq_Rahman_1-1712274119525.png

I am trying to create a summary table named "Int A" based on the date filtered. But it didn't work as expected.

 

 

 

Intl A = 
Var st_date =MIN(DIM_DATE[CALENDAR_DATE_SHORT_NAME])
Var en_date = MAX(DIM_DATE[CALENDAR_DATE_SHORT_NAME])
RETURN SUMMARIZE(CALCULATETABLE(FACT_BID_PER_OFFER,  FACT_BID_PER_OFFER[INTERVAL_DATE] >= st_date, FACT_BID_PER_OFFER[INTERVAL_DATE] < en_date), FACT_BID_PER_OFFER[STATION_NAME], "bid_vol", [BID_VOL])

 

 

 

I want the table to be refreshed based on my change on the slicer but it doesn't. I need this summary table to do further calculation. Is that something doable in power bi?

 

 

2 ACCEPTED SOLUTIONS
v-yiruan-msft
Community Support
Community Support

@amitchandak Thanks for your contribution on this thread.

Hi @Laiq_Rahman ,

As @amitchandak says, the data in the calculated table will not be changed by the user interactions(filter, slicer and so on). You can follow the steps below to get it:

1. Create a measure as below

Flag =
VAR st_date =
    MIN ( DIM_DATE[CALENDAR_DATE_SHORT_NAME] )
VAR en_date =
    MAX ( DIM_DATE[CALENDAR_DATE_SHORT_NAME] )
VAR idate =
    SELECTEDVALUE ( FACT_BID_PER_OFFER[INTERVAL_DATE] )
RETURN
    IF ( idate >= st_date && idate < en_date, 1, 0 )

2. Create a table visual with the necessary fields in the table 'FACT_BID_PER_OFFER' (include the field [INTERVAL_DATE]) and apply a visual-level filter with the condition (Flag is 1)

 

If the above ones can't help you figure out, please provide some raw data in your tables (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

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Laiq_Rahman
Helper I
Helper I

Hi,

 

I removed the date relationship as shown above on my screenshot. I've added start date and end date parameter. Then bind those parameters to work from power query. 

Laiq_Rahman_0-1713230955128.png

So, no more date column on my output. Whenever user select the dates then a direct query runs with those dates instead of doing summarize table. This works to some extent.

 

Another issue,  when i use parameter on the slicer then it doesn't let me to use the generic date slicer settings like between, relative options but that's a different issue which i need to think about how to resolve this.

 

Thanks guys.

View solution in original post

4 REPLIES 4
Laiq_Rahman
Helper I
Helper I

Hi,

 

I removed the date relationship as shown above on my screenshot. I've added start date and end date parameter. Then bind those parameters to work from power query. 

Laiq_Rahman_0-1713230955128.png

So, no more date column on my output. Whenever user select the dates then a direct query runs with those dates instead of doing summarize table. This works to some extent.

 

Another issue,  when i use parameter on the slicer then it doesn't let me to use the generic date slicer settings like between, relative options but that's a different issue which i need to think about how to resolve this.

 

Thanks guys.

v-yiruan-msft
Community Support
Community Support

@amitchandak Thanks for your contribution on this thread.

Hi @Laiq_Rahman ,

As @amitchandak says, the data in the calculated table will not be changed by the user interactions(filter, slicer and so on). You can follow the steps below to get it:

1. Create a measure as below

Flag =
VAR st_date =
    MIN ( DIM_DATE[CALENDAR_DATE_SHORT_NAME] )
VAR en_date =
    MAX ( DIM_DATE[CALENDAR_DATE_SHORT_NAME] )
VAR idate =
    SELECTEDVALUE ( FACT_BID_PER_OFFER[INTERVAL_DATE] )
RETURN
    IF ( idate >= st_date && idate < en_date, 1, 0 )

2. Create a table visual with the necessary fields in the table 'FACT_BID_PER_OFFER' (include the field [INTERVAL_DATE]) and apply a visual-level filter with the condition (Flag is 1)

 

If the above ones can't help you figure out, please provide some raw data in your tables (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

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Laiq_Rahman
Helper I
Helper I

Hi @amitchandra 

 

That calculated table doesn't have date field. The reason is the actual fields are calculating average, median, mean etc., When we add dates then the final value slightly differs from what is expected. Any other work around we have.

amitchandak
Super User
Super User

@Laiq_Rahman , Calculated Tables can not use slicer values. You need join the new table back with date and use in visual to get filters

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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