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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
galbatrox9
Helper I
Helper I

Chart - YTM with year and month slicer

Hi!

 

I  am trying to have my chart show the data for YTM based on the Year and Month slicer selected. So if i have 2019 and July selected, then chart should show  Jan2019 to July2019 data.

 

sample.PNG

I have uploaded a sample of my file. Can someone please help me with the dax?   Pbix file

1 ACCEPTED SOLUTION

Hi @galbatrox9 ,

 

1. You need add a comma before "12".

2. It should be "Start_Month" instead of "Start-Month".

3. You need to replace "Aggregation Column" with your own column name.

 

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi,

 

You can use the below DAX. Please change the Month Format to what you are using like "Jan", "Feb"... etc.

Measure:= VAR Year= SELECTEDVALUE(Table[Year])
VAR Start_Month=1
VAR Till_Month= SWITCH(SELECTEDVALUE(Table[Month]), "January",1,"February", 2, "March", 3, "April" ,  4, "May",  5,"June",6, "July", 7, "August" , 8, "September", 9, "October",  10, "November", 11,"December" 12,   
                "Unknown month number" )
RETURN MAXX(FILTER(Table, Table[Year]= Year && Table[Month] >= Start-Month && Table[Month]<= Till_Month), Table[Aggregation_Column])

Best Regards,
Vignesh M

If what I suggested worked for you feel free to Drop a "Kudos" and Consider to "Accept as Solution" if I solved your Issue 🙂

@Anonymous the Year reference is to the date table or my data table Table1?

 

 

Anonymous
Not applicable

Hi,

 

Same Table as the Filter. You can have it to Date Table

 

Best Regards,
Vignesh M

If what I suggested worked for you feel free to Drop a "Kudos" and Consider to "Accept as Solution" if I solved your Issue.

@Anonymous its giving me the below errors

 

error.PNG

Hi @galbatrox9 ,

 

1. You need add a comma before "12".

2. It should be "Start_Month" instead of "Start-Month".

3. You need to replace "Aggregation Column" with your own column name.

 

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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