Forum Discussion
migueldfr
Helper IV
1 year agoMeasure by buttoms
Hello I would liekt o improve this measure in order to get when I click on "mes actual hasta hoy" the values for the current month, ignoring any master Calendar[month name] selected. Total_Impo...
- 1 year ago
Hi migueldfr ,
Please confirm if this is the preferred way to display the different amounts on the chart. I have attached the PBIX file for your reference. Please let us know if any further details needed.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thank you!!
Sahir_Maharaj
Super User
1 year agoHello migueldfr,
Can you please try this approach:
Total_Importe_Cobro_Dinamico =
VAR SeleccionUsuario = SELECTEDVALUE('Seleccion_Rango_Fecha'[Opcion])
VAR MesActual = MONTH(TODAY())
VAR DiaActual = DAY(TODAY()) - 1
VAR AnioActual = YEAR(TODAY())
VAR MaxYear = MAX('MasterCalendar'[Year])
VAR MesEnContexto = MAX('MasterCalendar'[Month Number])
RETURN
SWITCH(
TRUE(),
-- Opción 1
SeleccionUsuario = "Mes actual hasta hoy",
CALCULATE(
SUM(CobrosAnx[importe_cobro]),
REMOVEFILTERS('MasterCalendar'[Month Name]), -- Remove any filter on the month
'MasterCalendar'[IsCurrentMonth] = 1, -- Filter by current month
'MasterCalendar'[Day] <= DiaActual -- Limit to the current day
),
-- Opción 2
SeleccionUsuario = "Rango de fechas",
CALCULATE(
SUM(CobrosAnx[importe_cobro]),
'MasterCalendar'[Date] >= MIN('MasterCalendar'[Date]) && -- Min selected date
'MasterCalendar'[Date] <= MAX('MasterCalendar'[Date]), -- Max selected date
'MasterCalendar'[Year] >= YEAR(MIN('MasterCalendar'[Date])) &&
'MasterCalendar'[Year] <= YEAR(MAX('MasterCalendar'[Date]))
),
-- Opción 3
SeleccionUsuario = "Por Meses",
CALCULATE(
SUM(CobrosAnx[importe_cobro]),
'MasterCalendar'[Month Number] = MesEnContexto, -- Month in context
IF(
MesEnContexto = MesActual, -- If it's the current month
'MasterCalendar'[Day] <= DiaActual, -- Limit to current day
TRUE() -- Show all if it's another month
)
)
)
Hope this helps!
- migueldfr1 year ago
Helper IV
Hello
CALCULATE( SUM(CobrosAnx[importe_cobro]), REMOVEFILTERS('MasterCalendar'[Month Name]), -- Remove any filter on the month 'MasterCalendar'[IsCurrentMonth] = 1, -- Filter by current month 'MasterCalendar'[Day] <= DiaActual -- Limit to the current day ),This measure does not work as mentioned, when I select march in this case does not show up anything
I want to keep the filter ofr this month static
Thanks