Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi everyone!
I have a table with 4 fields, date, status, product and liters. I have related this table with a dimension of date with date field.
I would like to get the following.
Assuming that the date range selected is from 09/01/2023 to 09/20/2023:
- If the status=A then show only the result for the min date of the selected date range, I mean show just the liters for 09/01/2023
- if the status= B o C show the sum of liters for all the dates between the selected date range.
- if the status=C show the sum of liters for the max date of the selected date range + 1 day, I mean show just the liters for 09/21/2023
According to this, for status A should be 50 liters, for status B should be 114, status C 95 and status D 41 liters.
I tried to create a flag like this:
But it does not work. I have also tried creating 3 measures, like this:
The desired result is the following:
Hi! I finally got it 🙂
The solution was to create two tables more of time with date field each one (dim_tiempo1 and dim_tiempo2). Those tables are not related to nothing.
I have created two filters, one with the date of dim_tiempo1 and another filter with the date of dim_tiempo2.
On the other hand, I changed the formula for literslike this:
Volume (L) =
VAR MinDate = MIN('DIM_TIEMPO1’[FECHA_ID])
VAR MaxDate = MAX('DIM_TIEMPO2’[FECHA_ID])
VAR MaxDatePlus1 = MaxDate + 1
RETURN
SUMX(
FILTER(
FACT_TABLE,
FACT_TABLE[Estado] = "A" && FACT_TABLE[Fecha]= MinDate ||
FACT_TABLE [Estado] IN {"B","C"} && (FACT_TABLE[Fecha]>= MinDate && FACT_TABLE[Fecha]<= MaxDate) ||
FACT_TABLE[Estado] = "D" && FACT_TABLE[Fecha]= MaxDatePlus1
),
FACT_TABLE[Litros]
)
that's all 🙂
Thank you!
@RuthMerchán , Create following measures
M1=
var _max = minx(allselected(table), Table[status] = "A"), Table[Date])
return
calculate(Sum(Table[liters]), Filter( table, Table[Date] =_max && Table[status] = "A"))
M2= calculate(Sum(Table[liters]), Filter( table, Table[status] in {"B", "C"}))
Sum Measure= Max(Values(Table[Status]), [M1] +[M2])
Hi! @amitchandak!
I have tried and finaly when I put the Sum Measure give this error:
Do you have some idea how can I make the measure to obtain the status D?
Thank you very much!
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.