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
Emerald70
Frequent Visitor

May to May data display on Power bi graphs

I have data from Jan 2022 to september 2024
I have 2 graphs
If I select on 2023 slicer
One graph is with sum(sales) from Jan 2023 to Dec 2023 to be displayed ( it is working)

However, my requirement is to display in another graph from May 2023 to May 2024  which is not working 
I have tried but it is showing from May 2023 to Dec 2023 

Could someone help me with this ?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks for the reply from FlipFlop1 , please allow me to provide another insight: 
Hi  @Emerald70 ,

I created some data:

vyangliumsft_0-1726037155128.png

As far as I know, when the slicer makes a selection, the visual that is related to the slicer field also changes dynamically, you might consider creating a table with no join relationship and using measure to affect the two visuals separately.

Here are the steps you can follow:

1. Create calculated table.

Table 2 =
DISTINCT('Table'[Year])

vyangliumsft_1-1726037155130.png

2. Create measure.

Visual_May2023toMay 2024 =
var _select=SELECTEDVALUE('Table 2'[Year])
var _mindate=DATE(_select,5,1)
var _maxdate=EOMONTH(DATE(_select+1,5,1),-1)
return
IF(
MAX('Table'[Date])>=_mindate&&MAX('Table'[Date])<=_maxdate,1,0)
Visual_allyear =
var _select=SELECTEDVALUE('Table 2'[Year])
return
IF(
MAX('Table'[Year])=_select,1,0)

3. Place each of the two measures in the corresponding visual filter and set it to 1.

vyangliumsft_2-1726037424232.png4. Result:

vyangliumsft_3-1726037467291.png

 

 

Best Regards,

Liu Yang

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

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Thanks for the reply from FlipFlop1 , please allow me to provide another insight: 
Hi  @Emerald70 ,

I created some data:

vyangliumsft_0-1726037155128.png

As far as I know, when the slicer makes a selection, the visual that is related to the slicer field also changes dynamically, you might consider creating a table with no join relationship and using measure to affect the two visuals separately.

Here are the steps you can follow:

1. Create calculated table.

Table 2 =
DISTINCT('Table'[Year])

vyangliumsft_1-1726037155130.png

2. Create measure.

Visual_May2023toMay 2024 =
var _select=SELECTEDVALUE('Table 2'[Year])
var _mindate=DATE(_select,5,1)
var _maxdate=EOMONTH(DATE(_select+1,5,1),-1)
return
IF(
MAX('Table'[Date])>=_mindate&&MAX('Table'[Date])<=_maxdate,1,0)
Visual_allyear =
var _select=SELECTEDVALUE('Table 2'[Year])
return
IF(
MAX('Table'[Year])=_select,1,0)

3. Place each of the two measures in the corresponding visual filter and set it to 1.

vyangliumsft_2-1726037424232.png4. Result:

vyangliumsft_3-1726037467291.png

 

 

Best Regards,

Liu Yang

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

Emerald70
Frequent Visitor

But I have to get the result based on selection right , I should select  bcz my DAX is like below

FilteredSales =
VAR SelectedYear = SELECTEDVALUE('Calendar'[Year])  // Capture the selected year from the slicer
VAR StartDate = DATE(SelectedYear, 5, 1)            // Define the start date as May 1st of the selected year
VAR EndDate = DATE(SelectedYear +1, 5,30)        // Define the end date as April 30th of the following year

RETURN
CALCULATE(
    SUM(MOM[Value]),
 FILTER(MOM,MOM[CustomDate] >= StartDate && MOM[CustomDate] <=  EndDate
    )
)

I would suggest just using current year and last year sales on the same graph:

FlipFlop1_0-1725980835969.png

DAX for last year as follows:

 

Sales LY = CALCULATE(SUMX(FactOnlineSales, (FactOnlineSales[SalesAmount])), SAMEPERIODLASTYEAR(DimDate[Datekey]))
 
This will work with the year selector.
FlipFlop1
Advocate I
Advocate I

It sounds like the 2023 slicer is slicing your 2nd graph. I you click on the slicer and select Format > Edit Interactions, you can prevent the slicer from acting on your graph (click the no-entry sign at the top right of the graph).  

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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