Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
MK9885
Master II
Master II

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...

dplr-rn
Partner - Master III
Partner - Master III

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

Vegar
MVP
MVP

A quick solution could be using an expression like this:

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

Anonymous
Not applicable
Author

thanks guys ; im very grateful

Vegar
MVP
MVP

Glad to help .

Please mark your question as solved.