<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Exposing all combinations of cyclically repeating calendar values in a straight table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Exposing-all-combinations-of-cyclically-repeating-calendar/m-p/1553259#M440435</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;For demonstration purposes, I have the following data set:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;DT&lt;/TD&gt;&lt;TD&gt;Event&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;TD&gt;2019-01-01 01:40:00&lt;/TD&gt;&lt;TD&gt;Blue&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;102&lt;/TD&gt;&lt;TD&gt;2019-01-01 12:40:00&lt;/TD&gt;&lt;TD&gt;Green&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;103&lt;/TD&gt;&lt;TD&gt;2019-01-01 12:41:00&lt;/TD&gt;&lt;TD&gt;Blue&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;104&lt;/TD&gt;&lt;TD&gt;2019-01-01 12:41:00&lt;/TD&gt;&lt;TD&gt;Blue&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;105&lt;/TD&gt;&lt;TD&gt;2019-01-01 18:21:00&lt;/TD&gt;&lt;TD&gt;Grey&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;106&lt;/TD&gt;&lt;TD&gt;2019-01-01 23:10:00&lt;/TD&gt;&lt;TD&gt;Purple&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;107&lt;/TD&gt;&lt;TD&gt;2019-02-01 02:50:00&lt;/TD&gt;&lt;TD&gt;Red&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;108&lt;/TD&gt;&lt;TD&gt;2019-02-01 12:33:00&lt;/TD&gt;&lt;TD&gt;Red&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;109&lt;/TD&gt;&lt;TD&gt;2019-02-01 14:00:00&lt;/TD&gt;&lt;TD&gt;Black&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;110&lt;/TD&gt;&lt;TD&gt;2019-04-01 01:30:00&lt;/TD&gt;&lt;TD&gt;Blue&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;111&lt;/TD&gt;&lt;TD&gt;2019-05-01 12:41:00&lt;/TD&gt;&lt;TD&gt;Black&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;112&lt;/TD&gt;&lt;TD&gt;2019-05-01 18:45:00&lt;/TD&gt;&lt;TD&gt;Red&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;113&lt;/TD&gt;&lt;TD&gt;2019-08-01 07:28:00&lt;/TD&gt;&lt;TD&gt;Blue&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need QV to display is a table with the headings:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;WeekDay&lt;/TD&gt;&lt;TD&gt;Hour&lt;/TD&gt;&lt;TD&gt;Record Count&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is that I need ALL weekdays (Sun to Sat) to be listed, and for each of the weekdays I need ALL hours (0 to 23) to be listed. 7*24=168 rows in total.&lt;/P&gt;&lt;P&gt;The actual data set is rather large and convoluted, but still subject to "gaps" when filtered, resulting in certain combinations of WeekDay and Hour to not be present in the table. I fudged a solution by adding a concatenation of weekday and hour into my master calendar, and subsequently forcing "Show All Values" on the table dimension. This is non-ideal, because I end up with one dimension column instead of two...and also because there's probably a better way to address this issue.&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;J.&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 21:17:27 GMT</pubDate>
    <dc:creator>jwaligora</dc:creator>
    <dc:date>2024-11-16T21:17:27Z</dc:date>
    <item>
      <title>Exposing all combinations of cyclically repeating calendar values in a straight table</title>
      <link>https://community.qlik.com/t5/QlikView/Exposing-all-combinations-of-cyclically-repeating-calendar/m-p/1553259#M440435</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;For demonstration purposes, I have the following data set:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;DT&lt;/TD&gt;&lt;TD&gt;Event&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;TD&gt;2019-01-01 01:40:00&lt;/TD&gt;&lt;TD&gt;Blue&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;102&lt;/TD&gt;&lt;TD&gt;2019-01-01 12:40:00&lt;/TD&gt;&lt;TD&gt;Green&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;103&lt;/TD&gt;&lt;TD&gt;2019-01-01 12:41:00&lt;/TD&gt;&lt;TD&gt;Blue&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;104&lt;/TD&gt;&lt;TD&gt;2019-01-01 12:41:00&lt;/TD&gt;&lt;TD&gt;Blue&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;105&lt;/TD&gt;&lt;TD&gt;2019-01-01 18:21:00&lt;/TD&gt;&lt;TD&gt;Grey&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;106&lt;/TD&gt;&lt;TD&gt;2019-01-01 23:10:00&lt;/TD&gt;&lt;TD&gt;Purple&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;107&lt;/TD&gt;&lt;TD&gt;2019-02-01 02:50:00&lt;/TD&gt;&lt;TD&gt;Red&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;108&lt;/TD&gt;&lt;TD&gt;2019-02-01 12:33:00&lt;/TD&gt;&lt;TD&gt;Red&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;109&lt;/TD&gt;&lt;TD&gt;2019-02-01 14:00:00&lt;/TD&gt;&lt;TD&gt;Black&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;110&lt;/TD&gt;&lt;TD&gt;2019-04-01 01:30:00&lt;/TD&gt;&lt;TD&gt;Blue&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;111&lt;/TD&gt;&lt;TD&gt;2019-05-01 12:41:00&lt;/TD&gt;&lt;TD&gt;Black&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;112&lt;/TD&gt;&lt;TD&gt;2019-05-01 18:45:00&lt;/TD&gt;&lt;TD&gt;Red&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;113&lt;/TD&gt;&lt;TD&gt;2019-08-01 07:28:00&lt;/TD&gt;&lt;TD&gt;Blue&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need QV to display is a table with the headings:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;WeekDay&lt;/TD&gt;&lt;TD&gt;Hour&lt;/TD&gt;&lt;TD&gt;Record Count&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is that I need ALL weekdays (Sun to Sat) to be listed, and for each of the weekdays I need ALL hours (0 to 23) to be listed. 7*24=168 rows in total.&lt;/P&gt;&lt;P&gt;The actual data set is rather large and convoluted, but still subject to "gaps" when filtered, resulting in certain combinations of WeekDay and Hour to not be present in the table. I fudged a solution by adding a concatenation of weekday and hour into my master calendar, and subsequently forcing "Show All Values" on the table dimension. This is non-ideal, because I end up with one dimension column instead of two...and also because there's probably a better way to address this issue.&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;J.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 21:17:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Exposing-all-combinations-of-cyclically-repeating-calendar/m-p/1553259#M440435</guid>
      <dc:creator>jwaligora</dc:creator>
      <dc:date>2024-11-16T21:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: Exposing all combinations of cyclically repeating calendar values in a straight table</title>
      <link>https://community.qlik.com/t5/QlikView/Exposing-all-combinations-of-cyclically-repeating-calendar/m-p/1553468#M440461</link>
      <description>&lt;P&gt;You will need to have hour and date in the same calendar table if you are to make any selection in date and/or hours.&lt;/P&gt;&lt;P&gt;The colde below will help you.&lt;/P&gt;&lt;PRE&gt;Transactions:
LOAD
	ID,
	Event,
	floor(DT) &amp;amp;  '|' &amp;amp; hour(DT) as %calendar,
	DT,
	1 as [No of events];
LOAD ID, 
     Timestamp#(DT, 'YYYY-DD-MM hh:mm:ss') as DT, 
     Event
FROM
	[https://community.qlik.com/t5/QlikView-App-Development/Exposing-all-combinations-of-cyclically-repeating-calendar/m-p/1553259#M440435]
	(html, codepage is 1252, embedded labels, table is @1);

for _date=date#('2019-01-01' , 'YYYY-DD-MM') to date#('2019-08-01', 'YYYY-DD-MM') step 1
	for _hour=1 to 24 step 1
		LOAD  
		$(_date)&amp;amp;'|'&amp;amp;$(_hour) as  %calendar,
		Date($(_date),'YYYY-DD-MM') as Date,
		weekday($(_date))  as Weekday,
		num($(_hour), '00') &amp;amp; ':00' as Hour
		AutoGenerate 1;
	next
next &lt;/PRE&gt;&lt;P&gt;Below a pivot chart in QlikView presenting the values. Remember to uncheck&amp;nbsp;&lt;EM&gt;Supress zero values&amp;nbsp;&lt;/EM&gt;in the chart properties.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 479px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/7464iB8B604014808B7DE/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 10:20:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Exposing-all-combinations-of-cyclically-repeating-calendar/m-p/1553468#M440461</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2019-03-07T10:20:13Z</dc:date>
    </item>
    <item>
      <title>Re: Exposing all combinations of cyclically repeating calendar values in a straight table</title>
      <link>https://community.qlik.com/t5/QlikView/Exposing-all-combinations-of-cyclically-repeating-calendar/m-p/1554473#M440545</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;With this approach (barring user error on my part) even with 'suppress zeros' unchecked, the data table shrinks when filters are applied.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The business need is very specific here - the output must be 3 columns, and 168 rows. Values (column total) must be reflective of selection criteria.&lt;/P&gt;&lt;P&gt;Here's the code for what I'm doing (pretty much same as yours...)&lt;/P&gt;&lt;PRE&gt;DataTab:
Load 
	ID,
	Timestamp#(DT, 'YYYY-MM-DD HH:mm:ss') as DT,
	Timestamp(Floor(Timestamp#(DT, 'YYYY-MM-DD HH:mm:ss'), 1/24),'YYYY-MM-DD HH') as DH,
	Event;

LOAD ID, 
     Timestamp#(DT, 'YYYY-DD-MM hh:mm:ss') as DT, 
     Event
FROM
	[https://community.qlik.com/t5/QlikView-App-Development/Exposing-all-combinations-of-cyclically-repeating-calendar/m-p/1553259#M440435]
	(html, codepage is 1252, embedded labels, table is @1);


Temp:
Load 
	min(Floor(DT,1/24),'YYYY-MM-DD HH:mm:ss') as minDT,
	max(Ceil(DT,1/24),'YYYY-MM-DD HH:mm:ss') as maxDT	
Resident DataTab;

LET vMinDT = peek('minDT');
LET vMaxDT = peek('maxDT');

Drop table Temp;

LET vDays = vMaxDT - vMinDT ;

MC:
LOAD 
	Timestamp(Floor(TempDate, 1/24),'YYYY-MM-DD HH') as DH,
	Hour(TempDate) as [Hour],
	Date(Floor(Date(TempDate,'YYYY-MM-DD')),'YYYY-MM-DD') as [Day],
	WeekDay(TempDate) as WkDay,
	WeekDay(TempDate) &amp;amp; ' ' &amp;amp; right(Timestamp(Floor(TempDate, 1/24),'YYYY-MM-DD HH'),2) as WkDayHr,
	Dual(Date([TempDate],'YYYY') &amp;amp; '-' &amp;amp; Date([TempDate],'MMM'), MonthStart([TempDate])) as [Month],
	Year(TempDate) as [Year]
;

LOAD
    Timestamp($(vMinDT) + (RecNo()-1)/24) as TempDate
AUTOGENERATE 24 * $(vDays) + 1;&lt;/PRE&gt;&lt;P&gt;The two approaches that work for me so far (both fudge'y) are:&lt;/P&gt;&lt;P&gt;(1) Create a straight table with Dimension = WkDayHr and Expression =&amp;nbsp;count({$} distinct ID).&amp;nbsp; Set Dimension to "Show All Values", for the Expression uncheck "Suppress Zero Values".&lt;/P&gt;&lt;P&gt;(2) Create a straight table with Dimensions: {WkDay, Hr} and Expression&amp;nbsp;=if (count({1} distinct ID) = count({$} distinct ID), count({$} distinct ID),count({$} distinct ID)) ... yes, it says "if True then apples else apples". For the Expression, uncheck "Supress Zero Values".&amp;nbsp; "Show All Values" does NOT need to be selected for either dimension.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first one fails to address the business need as it only uses 2 columns, while the second one uses a seemingly unnecessarily convoluted Expression calculation.&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;J.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 21:08:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Exposing-all-combinations-of-cyclically-repeating-calendar/m-p/1554473#M440545</guid>
      <dc:creator>jwaligora</dc:creator>
      <dc:date>2019-03-08T21:08:11Z</dc:date>
    </item>
  </channel>
</rss>

