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.
Hello!
I'm attempting to create a report using measures so that the values will update dynamically based upon the user's slicer selections. I have four slicers that filter the data based on date:
Period 1 Start
Period 1 End
Period 2 Start
Period 2 End
I've been successful with several measures that filter on only one period, but am having trouble when trying to filter when either is true, meaning the date falls within Period 1 OR Period 2 (allowing for the possibility that they're not consecutive).
Here's my measure:
Solved! Go to Solution.
Hi @ldavis4230 ,
We can try to use the following measure to meet your requirement:
Product Count =
CALCULATE (
DISTINCTCOUNT ( 'Product'[SKU] ),
FILTER (
Purchase,
OR (
AND (
RELATED ( 'Date of Purchase'[Purchase Date] )
>= SELECTEDVALUE ( 'P1 Start'[1st Day of Month], BLANK () ),
RELATED ( 'Date of Purchase'[Purchase Date] )
<= SELECTEDVALUE ( 'P1 End'[Last Day of Month], BLANK () )
),
AND (
RELATED ( 'Date of Purchase'[Purchase Date] )
>= SELECTEDVALUE ( 'P2 Start'[1st Day of Month], BLANK () ),
RELATED ( 'Date of Purchase'[Purchase Date] )
<= SELECTEDVALUE ( 'P2 End'[Last Day of Month], BLANK () )
)
)
)
)
If it doesn't meet your requirement, kindly share your sample data and expected result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.
Best regards,
Hi @ldavis4230 ,
We can try to use the following measure to meet your requirement:
Product Count =
CALCULATE (
DISTINCTCOUNT ( 'Product'[SKU] ),
FILTER (
Purchase,
OR (
AND (
RELATED ( 'Date of Purchase'[Purchase Date] )
>= SELECTEDVALUE ( 'P1 Start'[1st Day of Month], BLANK () ),
RELATED ( 'Date of Purchase'[Purchase Date] )
<= SELECTEDVALUE ( 'P1 End'[Last Day of Month], BLANK () )
),
AND (
RELATED ( 'Date of Purchase'[Purchase Date] )
>= SELECTEDVALUE ( 'P2 Start'[1st Day of Month], BLANK () ),
RELATED ( 'Date of Purchase'[Purchase Date] )
<= SELECTEDVALUE ( 'P2 End'[Last Day of Month], BLANK () )
)
)
)
)
If it doesn't meet your requirement, kindly share your sample data and expected result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.
Best regards,
Try like
Product Count = CALCULATE(DISTINCTCOUNT('Product'[SKU]),
FILTER(Purchase,
DATESBETWEEN('Date of Purchase'[Purchase Date],minx('P1 Start',SELECTEDVALUE('P1 Start'[1st Day of Month])),
maxx('P1 Start',SELECTEDVALUE('P1 End'[Last Day of Month])))||
DATESBETWEEN('Date of Purchase'[Purchase Date],minx('P2 Start',SELECTEDVALUE('P2 Start'[1st Day of Month]))
,maxx('P2 Start',SELECTEDVALUE('P2 End'[Last Day of Month]))
)))
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges
Connect on Linkedin
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
96 | |
77 | |
66 | |
53 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |