Forum Discussion
Need Last Month Data in My Card View
I have a calender that contain April is the starung Month & March is the Last Month of the year. For Example i have data like Month & Return as mention below
| Month | Return |
| Apr-23 | 53690 |
| May-23 | 54402 |
| Jun-23 | 40245 |
| Jul-23 | 52303 |
| Aug-23 | 34513 |
| Sep-23 | 51151 |
| Oct-23 | 44559 |
| Nov-23 | 50948 |
| Dec-23 | 69529 |
| Jan-24 | 61732 |
| Feb-24 | 53498 |
| Mar-24 | 53498 |
| Apr-24 | 53690 |
| May-24 | 54402 |
| Jun-24 | 40245 |
| Jul-24 | 52303 |
| Aug-24 | 34513 |
| Sep-24 | 51151 |
| Oct-24 | 44559 |
| Nov-24 | 50948 |
| Dec-24 | 69529 |
| Jan-25 | 1732 |
| Feb-25 | 3098 |
| Mar-25 |
Also I Have Year Filter 2023-24 & 2024-25
Now If i select 2023-24 than data should be Mar-24 Return (53498) & If i Select 2024-25 than Feb-25 Return (3098).
And I Add add data Of Mar-25 in next Month so 2024-25 Return Value Should be Mar-25 (Data)
Plz help me.
10 Replies
- Tutu_in_YYC
Super User
Before you try to get the last month calculation, you will need a fiscal date, bbecause your start date is not jan.
Have a look at how to set one up.
https://pragmaticworks.com/blog/dynamic-fiscal-year-date-table-using-dax-in-power-bi.
Then for the last month measure, you can just create a calculation using time intelligence or some manipulation of filter context.
Share a pbix if you can.- jackypatel
Helper I
i am unable to attached the File. Data is already There.
Plz help
- PijushRoy
Community Champion
Hi jackypatel
Please find the solution, attached PBIXPlease check the two calculated column in PBIX file
Measure = VAR _LatestMonth = IF(SELECTEDVALUE('Table'[Return])=0,MAX('Table'[Fiscal_Month_No])-1,MAX('Table'[Fiscal_Month_No])) RETURN CALCULATE(SUM('Table'[Return]),'Table'[Fiscal_Month_No]=_LatestMonth)- jackypatel
Helper I
Thanx for you support, But Its Not Working. If i added Mar-25 Data than it is also Showing Feb-25 Data.
Plz guide us further
- PijushRoy
Community Champion
Hi jackypatel
I have check with Feb 2025 data and without data, now working.
Please use the measure in same PBIX fileLatest Month Return = VAR SelectedYear = SELECTEDVALUE('Table'[Year]) VAR MaxMonthNo = CALCULATE( MAX('Table'[Fiscal_Month_No]), FILTER('Table', 'Table'[Year] = SelectedYear) ) VAR LatestMonthReturn = CALCULATE( MAX('Table'[Return]), FILTER('Table', 'Table'[Fiscal_Month_No] = MaxMonthNo && 'Table'[Year] = SelectedYear) ) VAR PreviousMonthReturn = CALCULATE( MAX('Table'[Return]), FILTER('Table', 'Table'[Fiscal_Month_No] = MaxMonthNo - 1 && 'Table'[Year] = SelectedYear) ) RETURN IF( ISBLANK(LatestMonthReturn), PreviousMonthReturn, LatestMonthReturn )
- v-menakakota
Community Support
Hi jackypatel ,
I hope the provided information by PijushRoy is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution so others can find it easily.
Thank you.- v-menakakota
Community Support
Hi jackypatel ,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
- v-menakakota
Community Support
Hi jackypatel ,
I would also take a moment to thank PijushRoy , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If the response has addressed your query, please accept it as a solution so that other community members can find it easily.
Thank you.