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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
Vsaez
Frequent Visitor

Problem to filter visual

Hello, I hope you are well

I have a column, called Year_Month, where I have a combination between the year and the month, for example 202101, 202102, etc etc

I have to filter a visual by two values from this column, 202105 and 202005:

Vsaez_0-1620165126114.png

I made a measure in DAX to filter it, which is the following:

Comparacion_Dia =
CALCULATE (
SUM ( '20 Medidas Reclamos'[Reclamo] ),
FILTER ('01 Tiempo Creación',
'01 Tiempo Creación'[Año Mes] = "202105" || '01 Tiempo Creación'[Año Mes] = "202005"
)
)

This formula works, but it has the dates as string type
So, I did this measurement in DAX so that based on current date it will calculate the value I need, for this year and last year.

 

Filtro Año Mes Actual =
VAR Fecha_actual=MAX('01 Tiempo Creación'[Date])
RETURN

IF(
LEN(MONTH(Fecha_actual))=1,
YEAR(Fecha_actual)&0&MONTH(Fecha_actual),
YEAR(Fecha_actual)&MONTH(Fecha_actual))
 
This measure gives me the value 202105, which was what I needed. However, when I replace this measure with the string I had in the previous measure, the filter doesn't work for me ...

Does anyone know why that will happen?

Thank you!

2 REPLIES 2
v-janeyg-msft
Community Support
Community Support

Hi, @Vsaez 

 

Is your problem been solved? I see that you didn't follow up. Have you checked the reply of others?

According to you description, The result of your two measures is not one thing, one is the value of sum, and the other is to return date. So I don't understand your question very well, Can you explain it in detail? Or share more information like your modified code,etc. So we can help you soon.

 

Best Regards

Janey Guo

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Greg_Deckler
Community Champion
Community Champion

@Vsaez A guess but check your data types and make sure that everything is a string and that you don't have a whole number data type in there for some reason. If you do, try adding & "" to it to force it to a string.



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...

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

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.

FabCon and SQLCon Highlights Carousel

FabCon & SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.