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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
SaiPriyaEleti
Frequent Visitor

How to show the any 10 years data

Hi,

I have a report which connects to ADX data source through DirectQuery. We have data from 1950s. So, i guess my report will give performance issues with such a huge data(as the load method is DirectQuery). I want users to access the whole historic data but not all at a time. So they want to see any 10 years data at a time. 

 

Is there any way to have the date slicer in a "between " format and at the same time restrict the user to select only the dates before 10 years from the start date.?

 

Example:

If the user selects 01/01/1950 in the start date,the end date should show dates only upto 01/01/1960

If the user selects 01/01/2010 in the start date,the end date should show dates only upto 01/01/2020

 

Please help me.

Thanks,

Sai Priya.

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @SaiPriyaEleti ,

You need  a data table and a date table ,they with no relationship between them.If you use a date in the data table as a slicer, then when you pick the value in the slicer, only one data for that date will be returned, so you need another date table.

Refer:

data_table = CALENDAR("1900,1,1","2021,1,1")
date_table = CALENDAR("1900,1,1","2021,1,1")

vluwangmsft_0-1646296281036.png

 

Then use the below measure:

TEST = 
IF (
    MAX ( 'data_table'[Date] )
        >= CALCULATE ( MIN ( 'date_table'[Date] ), ALLSELECTED ( 'date_table' ) )
        && MAX ( 'data_table'[Date] )
            <= DATE ( YEAR ( CALCULATE ( MIN ( 'date_table'[Date] ), ALLSELECTED ( 'date_table' ) ) ) + 10, MONTH ( CALCULATE ( MIN ( 'date_table'[Date] ), ALLSELECTED ( 'date_table' ) ) ), DAY ( CALCULATE ( MIN ( 'date_table'[Date] ), ALLSELECTED ( 'date_table' ) ) ) ),
    1,
    BLANK ()
)

 

Apply measure on filter:

vluwangmsft_1-1646296379313.png

 

Output:

When I choose   slicer:

vluwangmsft_2-1646296430436.png

Output maxdatevalue:

vluwangmsft_3-1646296454749.png

And when I choose 1922,the data table show the max date value is 1392:

vluwangmsft_4-1646296548112.png

 

 

You could download my pbix file if you need!

 

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


Best Regards

Lucien

View solution in original post

3 REPLIES 3
v-luwang-msft
Community Support
Community Support

Hi @SaiPriyaEleti ,

You need  a data table and a date table ,they with no relationship between them.If you use a date in the data table as a slicer, then when you pick the value in the slicer, only one data for that date will be returned, so you need another date table.

Refer:

data_table = CALENDAR("1900,1,1","2021,1,1")
date_table = CALENDAR("1900,1,1","2021,1,1")

vluwangmsft_0-1646296281036.png

 

Then use the below measure:

TEST = 
IF (
    MAX ( 'data_table'[Date] )
        >= CALCULATE ( MIN ( 'date_table'[Date] ), ALLSELECTED ( 'date_table' ) )
        && MAX ( 'data_table'[Date] )
            <= DATE ( YEAR ( CALCULATE ( MIN ( 'date_table'[Date] ), ALLSELECTED ( 'date_table' ) ) ) + 10, MONTH ( CALCULATE ( MIN ( 'date_table'[Date] ), ALLSELECTED ( 'date_table' ) ) ), DAY ( CALCULATE ( MIN ( 'date_table'[Date] ), ALLSELECTED ( 'date_table' ) ) ) ),
    1,
    BLANK ()
)

 

Apply measure on filter:

vluwangmsft_1-1646296379313.png

 

Output:

When I choose   slicer:

vluwangmsft_2-1646296430436.png

Output maxdatevalue:

vluwangmsft_3-1646296454749.png

And when I choose 1922,the data table show the max date value is 1392:

vluwangmsft_4-1646296548112.png

 

 

You could download my pbix file if you need!

 

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


Best Regards

Lucien

jaipal
Resolver III
Resolver III

Thanks Jaipal, I got the answer.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.