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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Bokazoit
Responsive Resident
Responsive Resident

How to ignore filter context in a variable for my measure

This measure:

 

Number of cases = 

VAR MinDato = MIN(DimDato[Date])

RETURN

CALCULATE(
    DISTINCTCOUNT(FactArvesager[ArvesagsKey]),
    FactArvesager[Forventet afsluttet Dato] >= MinDato &&
    FactArvesager[Bostarts Dato] < MinDato &&
    (FactArvesager[Realiseretarv Dato] = BLANK() || FactArvesager[Realiseretarv Dato] >= MinDato)
)

is not working as intented because of the VAR part.

 

The Variable is calculated in context to each row. So instead of the variable being fixed to the minimum value of my date filter:

Bokazoit_0-1650529095726.png

 

it is somehow being calculated pr. row.

I need the measure to calculated from the VAR being = 01-04-2022 and if I change the filter to another date it will change to that accordingly.

 

For now my only solution is to dublicate my date dimension and have that seperated. But that makes the model difficult for users to understand.

2 REPLIES 2
amitchandak
Super User
Super User

@Bokazoit , if DimDato is joined

 

Number of cases =

VAR MinDato = MIN(DimDato[Date])

RETURN

CALCULATE(
DISTINCTCOUNT(FactArvesager[ArvesagsKey]),filter( FactArvesager ,
FactArvesager[Forventet afsluttet Dato] >= MinDato &&
FactArvesager[Bostarts Dato] < MinDato &&
(FactArvesager[Realiseretarv Dato] = BLANK() || FactArvesager[Realiseretarv Dato] >= MinDato),
all(DimDato)
))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

That does not work. The MIN(DimDato[Date]) seems calculated per row. I seems to have a difficult time explaining my issue. I have this thread that explains it deeper:

 

https://community.powerbi.com/t5/Desktop/Why-is-my-table-aggregates-incorrect-but-the-total-is-corre...

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.