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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Measure with FILTER

Hello,

 

I am trying do write a measure using the function filter but it doesn't work fine. The code is :

 

Creusement hebdo TBM6 N =
(
CALCULATE(
[Creusement hebdo TBM6];
filter(TBM6__Date;TBM6__Date[ANNEE-SEMAINE]=[ANNEE-SEMAINE N TBM6])
)
)
 
TBM6__Date[ANNEE-SEMAINE] is a column of String values.
[ANNEE-SEMAINE N TBM6] is a String and contains "2020-S14" but doesn't match with TBM6__Date[ANNEE-SEMAINE]. However, if I replace [ANNEE-SEMAINE N TBM6] by its value "2020-S14" it is working successfully (see 3/)
 
1/Here the expression of [ANNEE-SEMAINE N TBM6]. Maybe it can help you to undestand my problem :
ANNEE-SEMAINE N TBM6 = convert(YEAR(max(TBM6__CAP_Pm[DATE])) &"-S" & if(WEEKNUM(max(TBM6__CAP_Pm[DATE]))<10;"0" & WEEKNUM(max(TBM6__CAP_Pm[DATE]));WEEKNUM(max(TBM6__CAP_Pm[DATE])));STRING)
 
2/ This test returns 1. I am sure that [ANNEE-SEMAINE N TBM6] contains exactly "2020-S14"
Creusement hebdo TBM6 N =
(
IF([ANNEE-SEMAINE N TBM6]="2020-S14";1;2)
)
 
3/ This test returns the right result (I changed [ANNEE-SEMAINE N TBM6] directly by "2020-S14"
Creusement hebdo TBM6 N =
(
CALCULATE(
[Creusement hebdo TBM6];
filter(TBM6__Date;TBM6__Date[ANNEE-SEMAINE]="2020-S14")
)
)
 
Have you got any idea of my problem ?
 
Thank you very much,
King regards
2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

What is Creusement hebdo TBM6? Is that a measure?

 

Really difficult to unwind what is going on.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Yes, Creusement hebdo TBM6 is a measure for many dates and I am trying te extract the value for a specific date.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.