Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
CGJA
Creator II
Creator II

Calculo del DOH Days of Inventory on Hand

buenas noches

acudo a ustedes para ver como puedo hacer que se repita la cantidad vendida 

lo que pretendo lo que marco en amarillo es la venta del articulo "81051"

CGJA_0-1682918773788.png

Lo estoy tratando de replicar en qlikSense pero no se como puedo hacer que se repita, en lo que marco en amarillo se tendría que repetir los "7,372"

CGJA_1-1682918883735.png

Espero me puedan apoyar ya que no logro dar el como se puede hacer

mi Set Analysis es :

Sum({<ArtDOH={'8'}>}Cantidad_Vendida)

Mil gracias por su apoyo

 

 

 

 

1 Solution

Accepted Solutions
AustinSpivey
Partner - Creator
Partner - Creator

It looks like there may be some changes you need to make to the data model. For instance, if you try to Join two tables together when they both share the same fields, you can sometimes run into issues of mixed granularity as described in this Henric Cronstrom article, as well as this one. Here's an example of what they may look like when joining tables in the Data Load Editor:

AustinSpivey_0-1682955148180.png

The ideal way for you to address the issue would be to adjust your data model accordingly. However, if you don't have control over the load script or you just need to get this working for the one chart, you should probably be able to achieve this using this expression in your pivot table:

=Only(Aggr(NODISTINCT Sum([Cantidad Vendida]), [Art]))

This works by using the Aggr() function with the NODISTINCT keyword and the Only() function. The Aggr() function essentially acts as a Group By clause for chart expressions, to use a SQL analogy. So we want Sum([Cantidad Vendida]) grouped on the [Art] dimension but we want to the Sum() value to be returned for each row rather than just for one row. That last part is handled by the NODISTINCT keyword. The Only() function is an aggregation function that returns a value only if there is one possible value to return. That works for us in our case because the Sum() value could only be one possible value since we already have our pivot table grouping this field by the [Art] dimension.

That expression should give you the desired result:

AustinSpivey_1-1682955424943.png

To learn more about why the Aggr() function was necessary, see this Qlik Help page about nested aggregations. To learn more about why the Only() function was helpful to us, see this Henric Cronstrom article that explains its usefulness.

Austin Spivey | Principal Consultant @ Arc Analytics
ArcAnalytics.us | Add me on LinkedIn

View solution in original post

1 Reply
AustinSpivey
Partner - Creator
Partner - Creator

It looks like there may be some changes you need to make to the data model. For instance, if you try to Join two tables together when they both share the same fields, you can sometimes run into issues of mixed granularity as described in this Henric Cronstrom article, as well as this one. Here's an example of what they may look like when joining tables in the Data Load Editor:

AustinSpivey_0-1682955148180.png

The ideal way for you to address the issue would be to adjust your data model accordingly. However, if you don't have control over the load script or you just need to get this working for the one chart, you should probably be able to achieve this using this expression in your pivot table:

=Only(Aggr(NODISTINCT Sum([Cantidad Vendida]), [Art]))

This works by using the Aggr() function with the NODISTINCT keyword and the Only() function. The Aggr() function essentially acts as a Group By clause for chart expressions, to use a SQL analogy. So we want Sum([Cantidad Vendida]) grouped on the [Art] dimension but we want to the Sum() value to be returned for each row rather than just for one row. That last part is handled by the NODISTINCT keyword. The Only() function is an aggregation function that returns a value only if there is one possible value to return. That works for us in our case because the Sum() value could only be one possible value since we already have our pivot table grouping this field by the [Art] dimension.

That expression should give you the desired result:

AustinSpivey_1-1682955424943.png

To learn more about why the Aggr() function was necessary, see this Qlik Help page about nested aggregations. To learn more about why the Only() function was helpful to us, see this Henric Cronstrom article that explains its usefulness.

Austin Spivey | Principal Consultant @ Arc Analytics
ArcAnalytics.us | Add me on LinkedIn