The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi, community!
Maybe it's an easy question, but I haven't found a good answer yet...
HOW can I select START and an END date (2 separate dropdowns) from the ONE column in the Calendar table?
And then filter all visuals on the page to show data for this range...
I tried to edit interactions between dropdowns and visuals and I also tried to have 2 separate calendar tables ... and nothing acceptable...
Maybe I did something wrong, so I really need the help of skilled people!
I really appreciate any ideas!
Thanks in advance!
Best wishes, Inna
Solved! Go to Solution.
Hi, @inna_sysco
You can create a Measure like the following to get the result you want.
Current Sales =
VAR start_date =
CALCULATE ( MIN ( Calendar_start[Date] ), ALLSELECTED ( Calendar_start[Date] ) )
VAR end_date =
CALCULATE ( MAX ( Calendar_end[Date] ), ALLSELECTED ( Calendar_end[Date] ) )
RETURN
CALCULATE (
SUM ( 'Table'[VALUE] ),
'Table'[DAYTIME] >= start_date
&& 'Table'[DAYTIME] <= end_date
)
The result looks like this:
Here is the pbix.
Best Regards,
Caiyun Zheng
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @inna_sysco
You can create a Calculated column and use it as the X axis of the visual.
Format DAYTIME = FORMAT(Table_test[DAYTIME],"mmm")&" "&YEAR(Table_test[DAYTIME])
The result looks like this:
Here is the pbix.
Best Regards
Caiyun Zheng
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @inna_sysco
You can create a Measure like the following to get the result you want.
Current Sales =
VAR start_date =
CALCULATE ( MIN ( Calendar_start[Date] ), ALLSELECTED ( Calendar_start[Date] ) )
VAR end_date =
CALCULATE ( MAX ( Calendar_end[Date] ), ALLSELECTED ( Calendar_end[Date] ) )
RETURN
CALCULATE (
SUM ( 'Table'[VALUE] ),
'Table'[DAYTIME] >= start_date
&& 'Table'[DAYTIME] <= end_date
)
The result looks like this:
Here is the pbix.
Best Regards,
Caiyun Zheng
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-cazheng-msft !
Thank you so much for the detailed explanation!
Your solution works great when I need to display the total on the card visual, but when I need to also manage the timeline it doesn't work...
Could you help me with that?
I am attaching the file where I tried to apply your solution.
Hi, @inna_sysco
You can create a Calculated column and use it as the X axis of the visual.
Format DAYTIME = FORMAT(Table_test[DAYTIME],"mmm")&" "&YEAR(Table_test[DAYTIME])
The result looks like this:
Here is the pbix.
Best Regards
Caiyun Zheng
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you, @v-cazheng-msft !
This works perfectly!
I very much appreciate your help!
@inna_sysco , For that you need two independent date tables.
Refer to my blog, where we have two ranges. In place of that, you can have two list and select dates, and use them in the same measure
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
Hi @amitchandak , thanks for your answer!
I tried to implement the solution presented in your article, but it doesn't work for me...
I used your measure to calculate sum:
Current Sales = ( VAR _Cuur_start = Min(‘Date’[Date Filer]) VAR _Curr_END = Max(‘Date’[Date Filer]) return calculate(sum(Sales[Sales Amount]),Sales[Sales Date] >= _Cuur_start && Sales[Sales Date] <= _Curr_END ))
But in my case, using SELECTEDVALUEs from 2 different slicers:
Current Sales = (
VAR _Cuur_start = SELECTEDVALUE('Calendar_start'[Date])
VAR _Curr_END = SELECTEDVALUE('Calendar_end'[Date])
return
calculate(sum(Table[VALUE]), Table[DAYTIME] >= _Cuur_start && Table[DAYTIME] <= _Curr_END ))
Maybe I did something wrong?