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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Bhargav150
Frequent Visitor

How to create new calculated table and filter it dynamically using measures

Hi I'm trying to create a new table based on existing dataset query1 in power bi, Because there is a duplicate values in the Snap_date column in the query1, But we need to use only Snap_date as filter so, that's why I have written a query like these 

 

First created a date table

 

Date Table = 

CALENDAR (

    Min('query1' [Snap_date], 

    Max('query1' [Snap_date]

)

 

Then created 2 measures in the Date Table

Start Date = Min('Date Table'[Date]

End Date = Max('Date Table'[Date]

 

  • My requirement is to place the Date Table Date column in the between slicer and when I change the slicer these values need to go in to measures, Up to here everything working as expected

 

In the last step I have created a table

 

NewTable =

SUMMARIZE (

    FILTER (

        query1,

        query1[SNAP_DATE] >= [Start Date] &&

        query1[SNAP_DATE] <= [End Date]

    ),

    query1[ID],

    query1[LN],

    query1[AMT],

    query1[CITY]

)

 

When I change the values in the slicer why these date measures are not filtering data according to the slicer

 

Please help!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Bhargav150 ,

The slicer visual can’t influence the calculated table.

Besides, try to calculate the measure to filter the new table.

Measure = 
var _date = SELECTEDVALUE(NewTable[SNAP_DATE])
RETURN
IF(_date >= [Start Date] && _date <= [End Date], 1, 0)

Then, set the show items is 1.

vjiewumsft_0-1721034170257.png

vjiewumsft_1-1721034200369.png

Viewing the following document to learn more information.

Using calculated tables in Power BI Desktop - Power BI | Microsoft Learn

 

Best Regards,

Wisdom Wu

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

5 REPLIES 5
Anonymous
Not applicable

Hi @Bhargav150 ,

Based on my testing, please try the following methods:

1.Create the sample table.

vjiewumsft_0-1721027668660.png

2.Create the new calculated table.

NewTable = 
SUMMARIZE (
	query1,
    query1[SNAP_DATE],
    query1[ID],
    query1[LN],
    query1[AMT],
    query1[CITY]
)

3.Create the new relationship between date table and calculated table.

vjiewumsft_1-1721027684395.png

4.Change the date range in the slicer visual.

vjiewumsft_2-1721027710591.png

5.The result is shown below.

vjiewumsft_3-1721027719826.png

 

Best Regards,

Wisdom Wu

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

Hi @Anonymous 

 

FYI, the SNAPSHOT_DATE column updates daily with yesterday's date, but apart from that, the remaining columns' data is 90 percent similar. If I include SNAPSHOT_DATE in the summary, it will cause many duplicates. That's the problem here.

Anonymous
Not applicable

Hi @Bhargav150 ,

The slicer visual can’t influence the calculated table.

Besides, try to calculate the measure to filter the new table.

Measure = 
var _date = SELECTEDVALUE(NewTable[SNAP_DATE])
RETURN
IF(_date >= [Start Date] && _date <= [End Date], 1, 0)

Then, set the show items is 1.

vjiewumsft_0-1721034170257.png

vjiewumsft_1-1721034200369.png

Viewing the following document to learn more information.

Using calculated tables in Power BI Desktop - Power BI | Microsoft Learn

 

Best Regards,

Wisdom Wu

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

some_bih
Super User
Super User

Hi @Bhargav150 without model and details it is hard to spot issue.

Still, try v2 below

NewTable v2 =

VAR __Start_Date = Min('Date Table'[Date]

VAR __End_Date = Max('Date Table'[Date]

RETURN


SUMMARIZE (

FILTER (

query1,

query1[SNAP_DATE] >= __Start_Date &&

query1[SNAP_DATE] <= __End_Date

),

query1[ID],

query1[LN],

query1[AMT],

query1[CITY]

)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Not working 😔 @some_bih 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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