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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
PPD
Helper I
Helper I

Dynamic date parameters to filter fact tables

I am working on a tabular cube.

My dashboard shows all summarized data (Fact Table 1) based on the snapshot date (1st day of each month - 05/01/2021,04/01/2021 etc.)

Based on the selected snapshot date, the users would also like to see the related sales data (Fact Table 2) from past three months.

e.g. If 1st May 2021 is selected in Fact Table 1, then user would like to see 3 months (1st Feb-1st May 2021) of sales lines data. They would like to see all row level sales information for past 3 months. If 1st April 2021 is selected, then it should show sales from 1st Jan -1st April.

There is no corelation between the date table of Fact table 1 and Fact table 2. Is there a way, I can pass date parameter values to Fact 2 to filter data for past 3 months? 

 

Thanks in advance.

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

Hi, @PPD  

 

You could create a measure by the following formula:

flag =
VAR _diff =
    DATEDIFF ( MAX ( 'Fact Table 2'[date] ), MAX ( 'Fact Table 1'[Date] ), MONTH )
RETURN
    IF ( _diff <= 3 && _diff > 0, 1 )

Then apply Flag measure to Filter:

v-yalanwu-msft_0-1620899134417.jpeg

The final output is shown below:

v-yalanwu-msft_1-1620899134418.png

Best Regards,
Community Support Team_ Yalan 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

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi, @PPD  

 

You could create a measure by the following formula:

flag =
VAR _diff =
    DATEDIFF ( MAX ( 'Fact Table 2'[date] ), MAX ( 'Fact Table 1'[Date] ), MONTH )
RETURN
    IF ( _diff <= 3 && _diff > 0, 1 )

Then apply Flag measure to Filter:

v-yalanwu-msft_0-1620899134417.jpeg

The final output is shown below:

v-yalanwu-msft_1-1620899134418.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.  

Thank you for your response.

Ashish_Mathur
Super User
Super User

Hi,

See if my solution here helps - Flex a Pivot Table to show data for x months ended a certain user defined month.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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