Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I have two tables. A and B. I want table B to show the detail corresponding to the previous 15 days from the date of the selected row in table A. For example, if I select a row in the table A with the date 2023-20-01, the table B should show the details from 2023-05-01, to 2023-19-01. I've tried different approaches but nothing worked. I'd appreciate any help or hint on the subject. Thanks in advance!
Solved! Go to Solution.
Hi @Agustinms ,
I am not sure if I understood your question correctly.
It sounds like you are using TableB to show the results after filtering in TableA.
Based on my understanding above, here is the data I created from the sample you provided.
TableA:
1.You can create a calcualted table.
Date = VALUES('TableA'[Date])
2. Use the following code to create a Measure.
Previous 15 Days Filter =
VAR _selectedDate = SELECTEDVALUE ( 'Date' [Date] )
VAR _startDate = _selectedDate - 15
VAR _endDate = _selectedDate - 1
RETURN
IF ( MAX('TableA'[Date]) >= _startDate && MAX('TableA'[Date]) <= _endDate, 1, 0 )
3. Select your visual object, put the measure in the “Filters on this visual” section, and filter it by “Measure is 1”.
The field of the slicer is from Date Table. When you select "1/20/2023" in the slicer, Result is as below.
Is this the result you expect?
Please correct me if I misunderstood your needs.
Best Regards,
Yulia Yan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Agustinms ,
I am not sure if I understood your question correctly.
It sounds like you are using TableB to show the results after filtering in TableA.
Based on my understanding above, here is the data I created from the sample you provided.
TableA:
1.You can create a calcualted table.
Date = VALUES('TableA'[Date])
2. Use the following code to create a Measure.
Previous 15 Days Filter =
VAR _selectedDate = SELECTEDVALUE ( 'Date' [Date] )
VAR _startDate = _selectedDate - 15
VAR _endDate = _selectedDate - 1
RETURN
IF ( MAX('TableA'[Date]) >= _startDate && MAX('TableA'[Date]) <= _endDate, 1, 0 )
3. Select your visual object, put the measure in the “Filters on this visual” section, and filter it by “Measure is 1”.
The field of the slicer is from Date Table. When you select "1/20/2023" in the slicer, Result is as below.
Is this the result you expect?
Please correct me if I misunderstood your needs.
Best Regards,
Yulia Yan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Yes! I tested the uploaded pbix and the result is what I was looking for. I tried using measures, but it didn't work for some reason. I'll try to replicate this in my report. Thank you very much for taking the time!!
You use disconnected tables and measures as visual filters.
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information or anything not related to the issue or question.
If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
Thanks for the advice. I already got a solution in a comment, but I'll keep this in mind for posts in the future!
User | Count |
---|---|
107 | |
88 | |
81 | |
76 | |
71 |
User | Count |
---|---|
112 | |
104 | |
96 | |
74 | |
66 |