The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.
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.
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.
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.
Hi @jackypatel
Please find the solution, attached PBIX
Please 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)
Proud to be a Super User! | |
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
Hi @jackypatel
I have check with Feb 2025 data and without data, now working.
Please use the measure in same PBIX file
Latest 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
)
Proud to be a Super User! | |
Thank you... Your Dax is working.
But in my Dax is not Showing the value. Because Calender (Date) & Return Value is different file.
So what shoud i do for this???
Kindly Help
Hi @jackypatel
You can create a relationship between Table and Calendar with a Date column (if you have one) or else Fiscal Month no column (I can see the column available in your data).
The use the DAX
Latest Month Return =
VAR SelectedYear = SELECTEDVALUE('Calendar'[Year])
VAR MaxMonthNo =
CALCULATE(
MAX(' Calendar '[Fiscal_Month_No]),
FILTER(' Calendar', ' Calendar '[Year] = SelectedYear)
)
VAR LatestMonthReturn =
CALCULATE(
MAX('Table'[Return]),
FILTER(' Calendar ', ' Calendar '[Fiscal_Month_No] = MaxMonthNo && ' Calendar'[Year] = SelectedYear)
)
VAR PreviousMonthReturn =
CALCULATE(
MAX('Table'[Return]),
FILTER(' Calendar', ' Calendar'[Fiscal_Month_No] = MaxMonthNo - 1 && ' Calendar'[Year] = SelectedYear)
)
RETURN
IF(
ISBLANK(LatestMonthReturn),
PreviousMonthReturn,
LatestMonthReturn
)
If not work, Please attached PBIX file link
Proud to be a 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.
i am unable to attached the File. Data is already There.
Plz help
User | Count |
---|---|
80 | |
74 | |
41 | |
30 | |
28 |
User | Count |
---|---|
107 | |
96 | |
53 | |
47 | |
47 |