问题
I have the following fact table :
ID_Activ Date_Start Date_End ID_session DayOfWeek Time_Start Time_End
1 01/02/2018 15/02/2018 11 4 08:00:00 10:00:00
2 01/02/2018 15/02/2018 21 4 09:00:00 10:00:00
3 01/03/2018 15/03/2018 31 2 09:00:00 10:00:00
I have a conventional dimensions date, and a custom dimension time with hours, minutes and seconds. I would like to slice or dice using these dimensions to get this output:
Date hour Count_session
01/02/2018 08 1
01/02/2018 09 2
01/02/2018 10 2
08/02/2018 08 1
08/02/2018 09 2
08/02/2018 10 2
15/02/2018 08 1
15/02/2018 09 2
15/02/2018 10 2
06/03/2018 09 1
06/03/2018 10 1
13/03/2018 09 1
13/03/2018 10 1
we don't show up the null Count_session.
I tried to created a named query with all hours include in date and hours range, but it generate very lot of data! Do you have another solution to linking a dimension with range dates ?
Thank you.
回答1:
You need to use non empty. Your query would look like this
select [measures].[count_session] on 0,
non empty
([Dim Date].[Date].[Date],[Dim CustomDate].[Hour].[Hour])
on 1
from
[YourCube]
来源:https://stackoverflow.com/questions/55541818/ssas-linking-a-date-dimension-to-an-interval-columns