Forum Discussion
Previous month dax returning balnk
My pas rate Dax
Pass Rate =
Var pas = SUM(QA_Main_AllFG[Check_QTY])
Var Def = SUM(QA_Main_AllFG[Defect_QTY])
RETURN
DIVIDE(pas,(pas+Def),0)
MY previous month dax
Pre_Month = CALCULATE(
[Pass Rate],
PREVIOUSMONTH('QA_Main_AllFG'[Date]))
previous month is showing blank
Please help me to solve the issues
- Anonymous1 year ago
Hi Anonymous ,
Thank you for reaching out to the Microsoft Fabric Community. Also thank you Cookistador for your input.
Regarding your issue with the PREVIOUSMONTH function returning blank values in your DAX measure, this behavior is typically caused by the way time intelligence functions interact with date contexts in your model.
Please following these steps, the PREVIOUSMONTH function will correctly identify the prior month based on your calendar table, and your Pre_Month measure will return expected, non-blank values.
- Ensure you have a dedicated calendar (date) table in your model that covers the entire date range you need. This table must have a continuous range of dates without gaps.
- In Power BI or Fabric, mark your calendar table as a Date table. This step is essential for the time intelligence functions like PREVIOUSMONTH to work properly.
You can do this by selecting the calendar table, then going to the Modeling tab and choosing “Mark as Date Table” and selecting the date column. - Modify your Pre_Month measure to reference the date column from your calendar table, not the date column in your fact table. For example:
Pre_Month = CALCULATE( [Pass Rate], PREVIOUSMONTH('Calendar'[Date]) )- There must be a one-to-many (1:* ) relationship between 'Calendar'[Date] and 'QA_Main_AllFG'[Date], with the filter direction from calendar table to fact table. Also make sure all date filters, slicers, and visuals are using the calendar table’s date columns to maintain a consistent and reliable filter context.
If you continue to face issues, please provide sample data of your model relationships so we can assist further.
I hope this will resolve your issue, if you need any further assistance, feel free to reach out.
If this post helps, then please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.
Thankyou.
7 Replies
- Cookistador
Super User
Do you have a calendar table in your model?
With the clues you shared with us, I think the issue is comming from
the fact that Time intelligence functions need a continuous range of dates to correctly identify periods like the "previous month."If your 'QA_Main_AllFG'[Date] column is just a column within your fact table and not related to a dedicated date table, or if your date table is not correctly set up or marked as a date table, Power BI cannot reliably determine what the "previous month" is in the context of your visual.
- AnonymousNot applicable
QA_Main_AllFG'[Date] it is data entry date column. I have a cematic date table in my power BI service.I have connect it and try it but result showing blank also
- Cookistador
Super User
Can you share some samples of your tables to let me make some tests on my side ?
- AnonymousNot applicable
Hi Anonymous ,
Thank you for reaching out to the Microsoft Fabric Community. Also thank you Cookistador for your input.
Regarding your issue with the PREVIOUSMONTH function returning blank values in your DAX measure, this behavior is typically caused by the way time intelligence functions interact with date contexts in your model.
Please following these steps, the PREVIOUSMONTH function will correctly identify the prior month based on your calendar table, and your Pre_Month measure will return expected, non-blank values.
- Ensure you have a dedicated calendar (date) table in your model that covers the entire date range you need. This table must have a continuous range of dates without gaps.
- In Power BI or Fabric, mark your calendar table as a Date table. This step is essential for the time intelligence functions like PREVIOUSMONTH to work properly.
You can do this by selecting the calendar table, then going to the Modeling tab and choosing “Mark as Date Table” and selecting the date column. - Modify your Pre_Month measure to reference the date column from your calendar table, not the date column in your fact table. For example:
Pre_Month = CALCULATE( [Pass Rate], PREVIOUSMONTH('Calendar'[Date]) )- There must be a one-to-many (1:* ) relationship between 'Calendar'[Date] and 'QA_Main_AllFG'[Date], with the filter direction from calendar table to fact table. Also make sure all date filters, slicers, and visuals are using the calendar table’s date columns to maintain a consistent and reliable filter context.
If you continue to face issues, please provide sample data of your model relationships so we can assist further.
I hope this will resolve your issue, if you need any further assistance, feel free to reach out.
If this post helps, then please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.
Thankyou.
- AnonymousNot applicable
Hi Anonymous ,
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 my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
- AnonymousNot applicable
Hi @mdmasumssg ,
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 my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you. - AnonymousNot applicable
Hi Anonymous ,
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.