Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi everyone, I am having this issue where I have to calculate the last year value, but I am not working with a format Date, because we are working with weeks.
I have a table like this, called View_BT_Comercial
In my page, I 've this filters wich I want to keep for the calculate of the last year:
So in one of my measures the DAX functions that i use to calculate the actual year and the last are :
ACTUAL :
Ventas_Totales = SUMX(View_BT_Comercial,View_BT_Comercial[Precio_Unitario]*View_BT_Comercial[Unidades])
LAST YEAR :
ventas_totales_LY = CALCULATE(sumx(View_BT_Comercial,View_BT_Comercial[Precio_Unitario]*View_BT_Comercial[Unidades]),filter(all(View_BT_Comercial),View_BT_Comercial[anioretail] =max(View_BT_Comercial[anioretail_ant]) && View_BT_Comercial[MesRetail] =max(View_BT_Comercial[MesRetail]) && View_BT_Comercial[semanaRetail] <=max(View_BT_Comercial[semanaRetail]) && View_BT_Comercial[Sucursal_ID]<=max(View_BT_Comercial[Sucursal_ID] )))
So, I tried with just the calculated filters, but the equal "=" doesn't wok, then I tried with the function FILTER(ALL( ... like i posted, but when I dont select a month, or week, or sucursal, it gives a wrong result, because of the "max" function ... so the next that i tried was FILTER(ALLEXCEPT( and put the columns sucursal, month and week, but nothing too .. I tried also with VALUES().
I really dont know what to use ... Like i said before, cause I am not working with a date format, i created a calculated column wich "anioretail-1" so i can get the last year, mainly because I cant use DATEADD.
I need to get the last year value for the same month, week and sucursal, are o aren't filtered values.
Thanks !!!
@axeelcs wrote:
Hi everyone, I am having this issue where I have to calculate the last year value, but I am not working with a format Date, because we are working with weeks.
I have a table like this, called View_BT_Comercial
In my page, I 've this filters wich I want to keep for the calculate of the last year:
So in one of my measures the DAX functions that i use to calculate the actual year and the last are :
ACTUAL :
Ventas_Totales = SUMX(View_BT_Comercial,View_BT_Comercial[Precio_Unitario]*View_BT_Comercial[Unidades])LAST YEAR :
ventas_totales_LY = CALCULATE(sumx(View_BT_Comercial,View_BT_Comercial[Precio_Unitario]*View_BT_Comercial[Unidades]),filter(all(View_BT_Comercial),View_BT_Comercial[anioretail] =max(View_BT_Comercial[anioretail_ant]) && View_BT_Comercial[MesRetail] =max(View_BT_Comercial[MesRetail]) && View_BT_Comercial[semanaRetail] <=max(View_BT_Comercial[semanaRetail]) && View_BT_Comercial[Sucursal_ID]<=max(View_BT_Comercial[Sucursal_ID] )))So, I tried with just the calculated filters, but the equal "=" doesn't wok, then I tried with the function FILTER(ALL( ... like i posted, but when I dont select a month, or week, or sucursal, it gives a wrong result, because of the "max" function ... so the next that i tried was FILTER(ALLEXCEPT( and put the columns sucursal, month and week, but nothing too .. I tried also with VALUES().
I really dont know what to use ... Like i said before, cause I am not working with a date format, i created a calculated column wich "anioretail-1" so i can get the last year, mainly because I cant use DATEADD.
I need to get the last year value for the same month, week and sucursal, are o aren't filtered values.
Thanks !!!
What is the expected output when no month, week and sucural are selected? Maybe you could use TODAY and ISFILTER in a IF() to return values accordingly. For further advice, please post more details and expected output.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
100 | |
81 | |
70 | |
62 |
User | Count |
---|---|
148 | |
116 | |
104 | |
90 | |
65 |