Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone!
I have a large code, here is an example:
If(RowNo()=1, $(vInicioPlantillaCNDistrital),
if(RowNo()=2,
$(vInicioPlantillaCNDistrital)+
Count({<[Año]={$(vAño)},HireTerm={'H'},MesN={"<2"}>}Distinct total EMPLOYEE)
-Count({<[Año]={$(vAño)},HireTerm={'T'},MesN={"<2"}>}Distinct total EMPLOYEE),
if(RowNo()=3,
$(vInicioPlantillaCNDistrital)+
Count({<[Año]={$(vAño)},HireTerm={'H'},MesN={"<3"}>}Distinct total EMPLOYEE)
-Count({<[Año]={$(vAño)},HireTerm={'T'},MesN={"<3"}>}Distinct total EMPLOYEE),
if(RowNo()=4,
$(vInicioPlantillaCNDistrital)+
Count({<[Año]={$(vAño)},HireTerm={'H'},MesN={"<4"}>}Distinct total EMPLOYEE)
-Count({<[Año]={$(vAño)},HireTerm={'T'},MesN={"<4"}>}Distinct total EMPLOYEE),
if(RowNo()=5,
$(vInicioPlantillaCNDistrital)+
Count({<[Año]={$(vAño)},HireTerm={'H'},MesN={"<5"}>}Distinct total EMPLOYEE)
-Count({<[Año]={$(vAño)},HireTerm={'T'},MesN={"<5"}>}Distinct total EMPLOYEE),
if(RowNo()=6,
$(vInicioPlantillaCNDistrital)+
Count({<[Año]={$(vAño)},HireTerm={'H'},MesN={"<6"}>}Distinct total EMPLOYEE)
-Count({<[Año]={$(vAño)},HireTerm={'T'},MesN={"<6"}>}Distinct total EMPLOYEE),
if(RowNo()=7,
...
I want to make this smaller, i think that rowno() could be useful here, i would like to use it in my set analisys in this way
(If(RowNo()=1, $(vInicioPlantillaCNDistrital),
if(RowNo()=2,
$(vInicioPlantillaCNDistrital)+
Count({<[Año]={$(vAño)},HireTerm={'H'},MesN={"<RowNo()"}>}Distinct total EMPLOYEE)
-Count({<[Año]={$(vAño)},HireTerm={'T'},MesN={"<RowNo()"}>}Distinct total EMPLOYEE),
if(RowNo()=3,
$(vInicioPlantillaCNDistrital)+
Count({<[Año]={$(vAño)},HireTerm={'H'},MesN={"<RowNo()"}>}Distinct total EMPLOYEE)
-Count({<[Año]={$(vAño)},HireTerm={'T'},MesN={"<RowNo()"}>}Distinct total EMPLOYEE),
if(RowNo()=4,
$(vInicioPlantillaCNDistrital)+
Count({<[Año]={$(vAño)},HireTerm={'H'},MesN={"<RowNo()"}>}Distinct total EMPLOYEE)
...
It looks like this is working, but in my bar chart, for example, on february i have 9.07 (expected result) and when i use rowno in my set analysis it goes to 9.17, this is wrong, the difference is not a lot but i need to be precise about this value since i am calculating turnover.
Thanks !
Set analysis cannot be evaluated on row by row basis... is it evaluated once per chart and that is why <RowNo() in set analysis won't really work.... what you can do is to use Pick() function instead of If to make it a little faster and a little better looking
Pick(RowNo()=1,
$(vInicioPlantillaCNDistrital), $(vInicioPlantillaCNDistrital) + Count({<[Año]={$(vAño)},HireTerm={'H'},MesN={"<2"}>}Distinct total EMPLOYEE) -Count({<[Año]={$(vAño)},HireTerm={'T'},MesN={"<2"}>}Distinct total EMPLOYEE), $(vInicioPlantillaCNDistrital)+ Count({<[Año]={$(vAño)},HireTerm={'H'},MesN={"<3"}>}Distinct total EMPLOYEE) -Count({<[Año]={$(vAño)},HireTerm={'T'},MesN={"<3"}>}Distinct total EMPLOYEE), $(vInicioPlantillaCNDistrital)+ Count({<[Año]={$(vAño)},HireTerm={'H'},MesN={"<4"}>}Distinct total EMPLOYEE) -Count({<[Año]={$(vAño)},HireTerm={'T'},MesN={"<4"}>}Distinct total EMPLOYEE), $(vInicioPlantillaCNDistrital)+ Count({<[Año]={$(vAño)},HireTerm={'H'},MesN={"<5"}>}Distinct total EMPLOYEE) -Count({<[Año]={$(vAño)},HireTerm={'T'},MesN={"<5"}>}Distinct total EMPLOYEE), $(vInicioPlantillaCNDistrital)+ Count({<[Año]={$(vAño)},HireTerm={'H'},MesN={"<6"}>}Distinct total EMPLOYEE) -Count({<[Año]={$(vAño)},HireTerm={'T'},MesN={"<6"}>}Distinct total EMPLOYEE), ... )
Set analysis cannot be evaluated on row by row basis... is it evaluated once per chart and that is why <RowNo() in set analysis won't really work.... what you can do is to use Pick() function instead of If to make it a little faster and a little better looking
Pick(RowNo()=1,
$(vInicioPlantillaCNDistrital), $(vInicioPlantillaCNDistrital) + Count({<[Año]={$(vAño)},HireTerm={'H'},MesN={"<2"}>}Distinct total EMPLOYEE) -Count({<[Año]={$(vAño)},HireTerm={'T'},MesN={"<2"}>}Distinct total EMPLOYEE), $(vInicioPlantillaCNDistrital)+ Count({<[Año]={$(vAño)},HireTerm={'H'},MesN={"<3"}>}Distinct total EMPLOYEE) -Count({<[Año]={$(vAño)},HireTerm={'T'},MesN={"<3"}>}Distinct total EMPLOYEE), $(vInicioPlantillaCNDistrital)+ Count({<[Año]={$(vAño)},HireTerm={'H'},MesN={"<4"}>}Distinct total EMPLOYEE) -Count({<[Año]={$(vAño)},HireTerm={'T'},MesN={"<4"}>}Distinct total EMPLOYEE), $(vInicioPlantillaCNDistrital)+ Count({<[Año]={$(vAño)},HireTerm={'H'},MesN={"<5"}>}Distinct total EMPLOYEE) -Count({<[Año]={$(vAño)},HireTerm={'T'},MesN={"<5"}>}Distinct total EMPLOYEE), $(vInicioPlantillaCNDistrital)+ Count({<[Año]={$(vAño)},HireTerm={'H'},MesN={"<6"}>}Distinct total EMPLOYEE) -Count({<[Año]={$(vAño)},HireTerm={'T'},MesN={"<6"}>}Distinct total EMPLOYEE), ... )