Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Remco
Contributor III
Contributor III

Retrieve the same value depending on dimensions in straight table

Hi all,

In a table I have values calculated per dimension. I need to repeat the values in the table where the year is always 2018 but differs on country, fueltype.

Remco_0-1670321984731.png

How can this be done?

Thank you!

Labels (3)
1 Solution

Accepted Solutions
Remco
Contributor III
Contributor III
Author

I solved it already...

 

(SUM(AVGPERF * NUMUNITS) / SUM(NUMUNITS))
/
(sum({<SALESYEAR = {"2018"}>}total <COUNTRYCODE, FUELTYPE> AVGPERF * NUMUNITS) / sum({<SALESYEAR = {"2018"}>}total <COUNTRYCODE, FUELTYPE> NUMUNITS))

View solution in original post

3 Replies
Remco
Contributor III
Contributor III
Author

I solved it already...

 

(SUM(AVGPERF * NUMUNITS) / SUM(NUMUNITS))
/
(sum({<SALESYEAR = {"2018"}>}total <COUNTRYCODE, FUELTYPE> AVGPERF * NUMUNITS) / sum({<SALESYEAR = {"2018"}>}total <COUNTRYCODE, FUELTYPE> NUMUNITS))

Aditya_Chitale
Specialist
Specialist

Is this what you wanted ?

test:
load*Inline
[
Country, fuel, year, Realized
XX, Diesel, 2017, 10
XX, Diesel, 2018, 20
XX, Diesel, 2019, 30
XX, Diesel, 2020, 40
XX, Diesel, 2021, 50

XX, Electric, 2017, 10
XX, Electric, 2018, 25
XX, Electric, 2019, 30
XX, Electric, 2020, 40
XX, Electric, 2021, 50

];

left join (test)

final:
load
    sum(Realized) as Desired_Output,
    Country,
    fuel
Resident test2 where year='2018' Group by Country, fuel;

Aditya_Chitale_0-1670330074420.png

 

Regards,

Aditya

Remco
Contributor III
Contributor III
Author

Hi, no, it was in the table itself but I already figured it out, see above.