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 September 15. Request your voucher.
Hi BI Community Team,
We want to show the full year by month of report that it's easy to see the progress. But data available is no full year yet, just available a few month as the screenshot below.
Any suggestion to show only the month that have data available?
Thanks and Regards,
The below 2 min tutorial will solve your problem!
Months in Slicer Appearing when you don't have any data ? PowerBI Tutorial - YouTube
Hi @miTutorials,
After checked and follow, it's still not working.
Could you please check my sample file? Here is the sample file: https://drive.google.com/drive/folders/1ekW7WBSa9h9gW2_6SYkVlhS3peeX_3GC?usp=sharing
By Relationship:
To display only the months for which data is available in Power BI, you can use a combination of techniques such as filtering and dynamic calculations. Here's a step-by-step approach to achieve this:
1. Determine the range of months for which data is available in your dataset.
2. Create a calendar table or use an existing date table in Power BI that includes all the months in the desired range. Ensure that the table has a relationship with your data table based on the month or date column.
3. In the report view, add a visual element (e.g., a table or a slicer) that displays the months from the calendar table.
4. Apply a filter to the visual element to include only the months for which you have data available. This can be done by selecting the "Visual filters" option in the "Format" pane and setting the filter condition to show only non-blank values.
5. Optionally, you can use conditional formatting to highlight or emphasize the months with data, making it easier to track progress.
By following these steps, you can ensure that only the months with available data are displayed in your Power BI report. This approach provides a dynamic view of the data, automatically adjusting as new months with data become available.
Remember to update the calendar table or refresh the data in Power BI as new months' data becomes available to maintain the accurate representation of progress in your report.
or Using
DAX :
To dynamically show only the months with available data using DAX in Power BI, you can create a calculated table or measure that filters the months based on the presence of data. Here's an example using a calculated table:
1. Create a new calculated table in Power BI Desktop by going to the "Modeling" tab and clicking on "New Table."
2. Use the following DAX formula to create the calculated table:
```dax
AvailableMonths =
VAR MinDate = MIN('YourTable'[DateColumn])
VAR MaxDate = MAX('YourTable'[DateColumn])
RETURN
ADDCOLUMNS(
CALENDAR(MinDate, MaxDate),
"HasData", IF(COUNTROWS(FILTER('YourTable', 'YourTable'[DateColumn] = [Date])) > 0, 1, 0)
)
```
Replace `'YourTable'` with the name of your data table, and `'DateColumn'` with the column that contains the dates.
3. This formula creates a calculated table called "AvailableMonths" that generates a calendar table between the minimum and maximum dates in your data. It adds a column "HasData" that checks if any rows exist in the original table for each date in the calendar table. If data is present, the "HasData" column will be 1; otherwise, it will be 0.
4. In the report view, use the "AvailableMonths" table to display the months. You can add a visual element like a table or slicer based on the "AvailableMonths" table to show only the months with available data.
By creating a calculated table using this approach, you can dynamically display only the months with data available, ensuring that your report reflects the progress based on the available data.
Hi @nabandla ,
Thank you for your value feedback.
But I have tried as your mention, it's still not working.
Could you please help to see my sample file?
Sample file: https://drive.google.com/drive/folders/1ekW7WBSa9h9gW2_6SYkVlhS3peeX_3GC?usp=sharing
Thanks and Regards,
User | Count |
---|---|
70 | |
64 | |
62 | |
48 | |
28 |
User | Count |
---|---|
113 | |
80 | |
64 | |
55 | |
43 |