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

Using the current opening balance

Hi folks,

For some reason what i thought would be quite simple is eluding me.

I have a table which captures a monthly opening balance based on a global region and how many tradesman within that region

DateLocationEcTypeAmount
01/08/2012Rest of WorldBuilders66
01/07/2012United KingdomElectricians12374
01/08/2012United KingdomElectricians12376
01/07/2012ChinaElectricians60
01/08/2012ChinaElectricians70
01/08/2012ChinaBuilders100
01/07/2012ItalyElectricians61
01/08/2012ItalyElectricians62

All im trying to display is the current months amount of tradesman by region , and then break that down by tradesman type. The bit thats eluding me is getting the value for the current month ni the set analysis equation

I'll also have a few date list boxes, which break down by years and month

using Location as a dimension Im using something along the lines of

=sum({$<Month(Date) = Month(Today(), Year(Date) = Year(Today())}>} DISTINCT Amount)

This work to a degree but only if something is selected on the date list box

All im after is something like

Current TradesmenAmount
date 01/08/2012
Rest of World66
United Kingdom12376
China170
Italy62

But this box will show the current month values regardless of whether anything is selected

many thanks

1 Solution

Accepted Solutions
RedSky001
Partner - Creator III
Partner - Creator III

Hi Lee,

See the attached qvw and let me know if this helps.

Markl

View solution in original post

8 Replies
RedSky001
Partner - Creator III
Partner - Creator III

Hi leewilliams,

 

You could create a pivot table with Date & Location as your dimensions.

Then add the following expresison.

 

sum({1 < Date = {'>=$(=MonthStart(Today()))<=$(=MonthEnd(Today()))'} >} Amount)

Think of creating a master calendar. There are a lot of good posts and an entry in the Wiki on how to get this done.

Mark

Not applicable
Author

HI Mark

Thanks for the response

I think you meant the dimensions should be location and ECType .. no?

Either way I have tried it with both date and ECType as dimension and using

=Sum ({1 < Date = {'>=$(=MonthStart(Today()))<=$(=MonthEnd(Today()))'} >}OBAmount)

I just get 0 as the answer

I think i understand what the set analysis expression is trying to do but its just not bringing back the right answer

the only difference between the value of Date and today() i could see was 'Date ' was a date/time value and today()  was just a date . Would that make a difference ?

I already have a master calender in the structure with a trans table linking the other tables to it , just havent dont that with this table yet.

Lee

RedSky001
Partner - Creator III
Partner - Creator III

Hi Lee,

See the attached qvw and let me know if this helps.

Markl

Not applicable
Author

HI Mark

Appreciate all the help and your table helped immensley, thank you. The issue was around the date field being joined to the calendar with the same field name

As a stand alone table you method works perfectly well

but then if i link it to the master calendar and so I can do an opening balance over time chart, the over view table falls over. I can probably address that by using the trans link table

thanks

Not applicable
Author

As i thought as soon as I linked it back to the master calendar it fell over again. At least this time it was showing me some values

with date being on the master calendar and linked to the opening balance table through an ID table

using

=Sum({1<Date={'=$(=MonthStart(Today()))'} >}OBAmount)

produced opening balance values for every month

using

=Sum ({1 < Date = {'>=$(=MonthStart(Today()))<=$(=MonthEnd(Today()))'} >}OBAmount)

just didnt' bring back any values at all.

Can't believe something this simple in SQL is so complicated.

RedSky001
Partner - Creator III
Partner - Creator III

Can you upload an example qvw file?

Not applicable
Author

Hi Mark

Sorry its company information which i cant upload, but heres the scehma

The chart is a pivot using dimensions from

date from table ECdate

and OBlocation from OpenECBalance

and expression

=Sum({1<Date={'=$(=MonthStart(Today()))'} >}OBAmount)

The ECTrans table is created in SQL and then called via a stored proc into qlikview

OpenECBalance looks akin to this , but ive had to change actual values but not column headings

OBIDOBAmountEcTypeOBLocation
37916BuilderRest of World
380638electricianRest of World
3818plumberUnited Kingdom
382806brickieUnited Kingdom
3833359labourerUnited Kingdom
384138BuilderUnited Kingdom
38512254foremanUnited Kingdom
3863102electricianUnited Kingdom
38738531CarpentarUnited Kingdom
38840foremanChina
3894electricianChina
39054CarpentarChina
39117foremanIndia
3921electricianIndia
39340labourerIndia
394146CarpentarIndia
395644electricianRest of World
39616BuilderRest of World
3971224foremanRest of World
3988241CarpentarRest of World
39963brickieRest of World
400274labourerRest of World
4013103electricianUnited Kingdom
4028plumberUnited Kingdom
403153BuilderUnited Kingdom
40438641CarpentarUnited Kingdom
4053379labourerUnited Kingdom

dotn know how helpful this is or how to quickly generate something similar quickly

Not applicable
Author

I found another way of doing it using this method which works perfectly for me , thanks for your help mark

http://community.qlik.com/message/2702#2702