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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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
Super User
Super User

@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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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