Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
oualeeed
New Contributor

help me with chart percentage calculation

hi ,

i make a chart to calculate the percentage of how much the machine work in 24 h , but i want to make a condition if the day is saturday , i want just the percentage of 4 h not 24h .

thank you

5 Replies
Highlighted
MK9885
Honored Contributor II

Re: help me with chart percentage calculation

I guess the easiest way I think is..

If you have a master calendar then you may also have a field Week Day in it.

If you don;t then create 1

MasterCalendar:

////Preceding load////

Load*,

if([Week Day]='Sat',1,0) as SatFlag;

////// Original Load//////

Load

weekDay(TempDate) as [Week Day]

...

...

From....


and in front end maybe use

Sum(amount)

/

(if([Week Day]='Sat',

sum({< SatFlag={1}, Hour= {4}  >}Amout) ,

Sum(Amount)))


This may work if you have an Hour field where you can hard code 4


or Maybe an expert can help you on this...

Highlighted
Partner
Partner

Re: help me with chart percentage calculation

Why not create the the column while loading in the script? i.e the column will contain either 24 or 4

if(weekday(your_datecolumn)='Sun' or weekday(your_datecolumn)='Sat' ,4,24) as Num_Hours_Counted_PerDay

Highlighted
Partner
Partner

Re: help me with chart percentage calculation

A quick solution could be using an expression like this:

sum(Duration) / if(Weekday=6,4/24,1)

Plees ekskuse my Swenglish and or Norweglish spelling misstakes
Highlighted
oualeeed
New Contributor

Re: help me with chart percentage calculation

thanks guys ; im very grateful

Highlighted
Partner
Partner

Re: help me with chart percentage calculation

Glad to help .

Please mark your question as solved.

Plees ekskuse my Swenglish and or Norweglish spelling misstakes