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 moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
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.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
89 | |
88 | |
82 | |
64 | |
49 |
User | Count |
---|---|
125 | |
111 | |
88 | |
69 | |
66 |