Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreShape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.
Background / setup:
I got three fact tables (data from three different Sharepoint Lists) linked up to one Date Dimension Table. I'm using a date slicer to filter my report so that I can view how many items that were created on any particular day.
Problem:
For one of the fact tables, instead of showing items created per date, I'd like to view "Valid items" for any given date. Valid items will be items where the chosen date falls on or between separate columns for "Valid from" and "Valid to".
I'm not too experienced with Power BI, and I can't wrap my head around how this could be achieved. Hope someone can give some guidance on the matter. 🙂
Solved! Go to Solution.
Hi, @tslupphaug
You can try the following methods.
Count1 = CALCULATE(COUNT('Facts 1'[Title]),FILTER(ALL('Facts 1'),[Created]=SELECTEDVALUE('Date'[Date])))+0
Count2 =
CALCULATE ( COUNT ( 'Facts 2'[Title] ),
FILTER ( ALL ( 'Facts 2' ),
[Valid from] <= SELECTEDVALUE ( 'Date'[Date] )
&& [Valid to] >= SELECTEDVALUE ( 'Date'[Date] )
)
) + 0
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Share some data to work with and show the expected result.
Example data:
Facts 1
Created | Title |
01-25-2023 | Test record 1-1 |
01-25-2023 | Test record 1-2 |
01-23-2023 | Test record 1-3 |
01-18-2023 | Test record 1-4 |
Facts 2
Created | Title | Valid from | Valid to |
01-25-2023 | Test record 2-1 | 01-25-2023 | 01-30-2023 |
01-25-2023 | Test record 2-2 | 01-25-2023 | 01-30-2023 |
01-22-2023 | Test record 2-3 | 01-22-2023 | 01-27-2023 |
01-18-2023 | Test record 2-4 | 01-19-2023 | 01-23-2023 |
DateDimensionTable
Dates |
02-01-2023 |
01-31-2023 |
01-30-2023 |
01-29-2023 |
01-28-2023 |
01-27-2023 |
01-26-2023 |
01-25-2023 |
01-24-2023 |
01-23-2023 |
(and so on) |
Report (expected result)
Example A
Date slicer set to: 01-25-2023
Count Facts 1 (Created on 01-25-2023): 2
Count Facts 2 (Valid on 01-25-2023): 3
Example B
Date slicer set to: 01-24-2023
Count Facts 1 (Created on 01-24-2023): 0
Count Facts 2 (Valid on 01-24-2023): 1
Hi, @tslupphaug
You can try the following methods.
Count1 = CALCULATE(COUNT('Facts 1'[Title]),FILTER(ALL('Facts 1'),[Created]=SELECTEDVALUE('Date'[Date])))+0
Count2 =
CALCULATE ( COUNT ( 'Facts 2'[Title] ),
FILTER ( ALL ( 'Facts 2' ),
[Valid from] <= SELECTEDVALUE ( 'Date'[Date] )
&& [Valid to] >= SELECTEDVALUE ( 'Date'[Date] )
)
) + 0
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Yes, this is exactly the result I want. Thank you!
@v-zhangti How could I also show a table in my report with all the valid items?
Hi,
You may download my PBI file from here.
Hope this helps.
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
User | Count |
---|---|
93 | |
92 | |
84 | |
82 | |
49 |
User | Count |
---|---|
145 | |
142 | |
111 | |
71 | |
55 |