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.
This week is not completed right..So fro example the last week dates are'BETWEEN '2024-02-05' and '2024-02-11'. and I want to get how many Count created from last week to this week difference. How can I get ..
"select COUNT( DISTINCT TOUR_REQUEST_NO) from s_spl_qmr_do_weekly_2024_f join m_date_d on INQUIRY_DATE_KEY = date_key where WEEK_NO =7 and FULL_DATE BETWEEN '2024-02-05' and '2024-02-11' "
I have build this Query in sql..please convert this into PBI DAX function
It is exactly logic