Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
feralvarez994
Helper II
Helper II

Calculated table

Hi everyone, i have the following calculated table

TablaSemestres =
ADDCOLUMNS(
    GENERATESERIES(
        DATE(2000, 1, 1),
        DATE(2025, 12, 31),
        183
    ),
    "Fecha de compra",
        DATE(YEAR([Value]), IF(MONTH([Value]) <= 6, 1, 7), 1),
    "Fecha de venta",
        EOMONTH(DATE(YEAR([Value]), IF(MONTH([Value]) <= 6, 6, 12), 1), 0)
)
And the following calculated column
Stock =
-- CONTAR AUTOS COMPRADOS ANTES DE LA FECHA DE COMPRA Y VENDIDOS DESPUES DE LA FECHA DE VENTA (O QUE FECHA DE VENTA ESTÉ EN BLANCO),
-- ES DECIR, COMPRADOS VENDIDOS + COMPRADOS SIN VENDER,
-- QUE NO SEAN FLOTA NI OBSOLETA
var buydate = TablaSemestres[Fecha de compra]
var selldate = TablaSemestres[Fecha de venta]
var stock =
CALCULATE(
    COUNT(AUTOS[AT_COAUTO]),
    AUTOS[FECHA COMPRA] <= buydate
    &&AUTOS[Fecha Reserva] >= selldate || AUTOS[Fecha Reserva] = BLANK(),
    CLAAUTOS[CLAU_DETALLE] <> "FLOTA" && CLAAUTOS[CLAU_DETALLE] <> "OBSOLETA",
    ALL(TablaSemestres)
)
return IF(TablaSemestres[Value] > TODAY(), 0, stock)
feralvarez994_0-1679330567790.png

 

I want to add a new column in the calculated table with the different cities of the table (AUTOS) to get the stock of every city each semester. Can someone help me ?
1 REPLY 1
lbendlin
Super User
Super User

Instead of GENERATESERIES use a proper calendar table that includes a semester/half year column.

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.