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
German_043
Frequent Visitor

Filter with dax function

I have a report in Power bi where I show information from different countries, when I select a city it shows me the information from only that country, but I want it to make a sum of the information from the last quarter when no city is selected.
But I already have a dax function and I would just like to add that parameter

INDU_INVENTARIO = 
/*Variables para seleccionar el idiona*/
VAR Seleccion = SELECTEDVALUE(IDIOMAS[Idioma])

/*Variables para encontrar el ultimo registro en base a la columna de fecha y el valor buscado */
var _lastDateMetro = MAXX(FILTER(Industrial_Latam,NOT(ISBLANK(Industrial_Latam[Inventario Industrial (m²)]))),Industrial_Latam[Fecha])
var _lastDateSQF = MAXX(FILTER(Industrial_Latam,NOT(ISBLANK(Industrial_Latam[Inventario Industrial (sqf)]))),Industrial_Latam[Fecha])

/*Varibles donde se guarda el ultimo valor ecncontrado*/
var Metro = MAXX(FILTER(Industrial_Latam,Industrial_Latam[Fecha]=_lastDateMetro),Industrial_Latam[Inventario Industrial (m²)])
var SQF = MAXX(FILTER(Industrial_Latam,Industrial_Latam[Fecha]=_lastDateMetro),Industrial_Latam[Inventario Industrial (sqf)])

Var SUM_INV = MAXX(FILTER(Industrial_Latam,Industrial_Latam[Fecha]=_lastDateMetro),SUM(Industrial_Latam[Inventario Industrial (sqf)]))

Var Formato =
SWITCH (
    TRUE,
    Seleccion = "ESP", Metro,
    Seleccion = "ENG", SQF,
    SUM_INV
    )
return Formato

German_043_0-1698680906731.png

 

How could I add that parameter while respecting the other conditions?



1 REPLY 1
lbendlin
Super User
Super User

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
If you are unsure how to do that please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

If you want to get answers faster please refer to https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

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.