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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
NISHA_S
Resolver I
Resolver I

users select on month slicer and load previous month data only

Screenshot 2022-11-04 104025.png

 

Hi all,

               i have to create using above data. Requirement is one month slicer will be there from jan-dec based on date column from my data.Suppose a user select dec month on slicer ,data will load only from nov1 to nov 30 data. ie, previous month data need to load. Is it possible?

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @NISHA_S ,

 

As far as I know, based on Bifinity_75 's reply, the code will only return the summarize result based on SUM().

If there is an reltionship between your date table and your data table, your visual will be filtered by relationship. So you couldn't see last month date in your month. If you don't only want to show aggregation in a card visual, please change the relationship between two tables to inactive and create a measure to filter your table visual.

RicoZhou_0-1667814252476.png

Measure:

Filter = 
VAR _MAXDATE = MAX('Calendar'[Date])
VAR _RANGEEND = EOMONTH(_MAXDATE,-1)
VAR _RANGESTART = EOMONTH(_MAXDATE,-2)+1
RETURN
IF(MAX('Table'[Date]) >=_RANGESTART && MAX('Table'[Date])<=_RANGEEND,1,0)

Result is as below.

RicoZhou_1-1667814466632.png

Best Regards,
Rico Zhou

 

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

2 REPLIES 2
v-rzhou-msft
Community Support
Community Support

Hi @NISHA_S ,

 

As far as I know, based on Bifinity_75 's reply, the code will only return the summarize result based on SUM().

If there is an reltionship between your date table and your data table, your visual will be filtered by relationship. So you couldn't see last month date in your month. If you don't only want to show aggregation in a card visual, please change the relationship between two tables to inactive and create a measure to filter your table visual.

RicoZhou_0-1667814252476.png

Measure:

Filter = 
VAR _MAXDATE = MAX('Calendar'[Date])
VAR _RANGEEND = EOMONTH(_MAXDATE,-1)
VAR _RANGESTART = EOMONTH(_MAXDATE,-2)+1
RETURN
IF(MAX('Table'[Date]) >=_RANGESTART && MAX('Table'[Date])<=_RANGEEND,1,0)

Result is as below.

RicoZhou_1-1667814466632.png

Best Regards,
Rico Zhou

 

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

 

Bifinity_75
Solution Sage
Solution Sage

Hi @NISHA_S , 

If you don't have a full column of dates. The first thing you have to do is create one, inserting a table, and writing the function: 

Calendar = CALENDAR(min(Table1[start date]),max(Table1[start date]))

Then you have to relate the 2 columns:

Bifinity_75_0-1667760099190.png

 

And finally create the following measure:

 

Amount_p = CALCULATE(sum(Table1[amount]),PREVIOUSMONTH('Calendar'[Date]))

 

Best regards

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.