Forum Discussion
Need help
To achieve your goal in Power BI, you can follow these steps:
Create a Calendar Table: Ensure you have a calendar table that includes a date column (FULL_DATE in your case) which links to the INQUIRY_DATE_KEY in your main table.
Create Measures:
- First, create a measure that calculates the distinct count of TOUR_REQUEST_NO for the current week. This measure will use the relationship between your main table and the date table.
- Then, create another measure to filter the count to only include the current week days.
Create a Line Chart:
- Use the week number from your calendar table on the X-axis.
- Use the distinct count measure on the Y-axis.
Here's how you can create the measures:
- Distinct Count of TOUR_REQUEST_NO for the Current Week:
Tour Requests This Week =
CALCULATE (
DISTINCTCOUNT ( 'Append-QMR'[TOUR_REQUEST_NO] ),
DATESBETWEEN (
'M_INQ_DATE_D'[FULL_DATE],
FIRSTDATE ( 'M_INQ_DATE_D'[FULL_DATE] ),
LASTDATE ( 'M_INQ_DATE_D'[FULL_DATE] )
)
)
Distinct Count of TOUR_REQUEST_NO for Current Week Days:
Tour Requests This Week Days =
CALCULATE (
[Tour Requests This Week],
FILTER (
ALLSELECTED ( 'M_INQ_DATE_D'[FULL_DATE] ),
WEEKDAY ( 'M_INQ_DATE_D'[FULL_DATE] ) <> 1
&& WEEKDAY ( 'M_INQ_DATE_D'[FULL_DATE] ) <> 7
)
)
In the second measure, the FILTER function ensures that only the weekdays (Monday to Friday) are considered. Adjust the weekday numbers according to your locale if needed.
Now, you can create a line chart:
- Drag the week number from your calendar table to the X-axis.
- Use the Tour Requests This Week Days measure for the Y-axis.
This chart will display the count of distinct tour request numbers for the weekdays of the current week over the week numbers. Adjust your visualizations as needed based on your data and preferences.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.
It is showing blank value for both the measures...
my Question is ...I have Append-QMR table in power bi . in that I have TOUR_REQUEST_NO and FULL_DATE and WEEK_NO columns . I need to calculate DISTICTCOUNT of TOUR_REQUEST_NO for each week individually between the dates which are falls in a week from FULL_DATE column. for example for 7th week falls between the dates '2024-02-11 to 2024-02-18 ', for that week the count should be between these dates like this .it should be showed in line chart like as WEEK_NO in X-Axis and No.Of counts in Y-axis.