Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
both the measure are returning same value throughout the column, please correct
Solved! Go to Solution.
It looks like both measures are returning the same value because they are calculating the count of bookingid in the same context (i.e., the same filter is applied to the vw_community_care_cancellation_report table in both measures). The first measure is using a variable CW to store the maximum value of weeknumber in the table, and then using that variable in the FILTER function to return the count of bookingid for that week. The second measure is using the WEEKNUM function to get the current week number (relative to the first week of the year), and then using that value in the FILTER function to return the count of bookingid for that week. Since both measures are effectively doing the same thing (counting the number of bookingid for the current week), they will return the same value.
To fix the problem, you will need to modify the measures to calculate different values. For example, you could modify the first measure to calculate the count of bookingid for the previous week instead of the current week. Here is one way you could do that:
CW Cancellations =
VAR PreviousWeek =
CALCULATE (
MAX ( vw_community_care_cancellation_report[weeknumber] ),
ALLSELECTED (vw_community_care_cancellation_report ),
vw_community_care_cancellation_report[weeknumber] < WEEKNUM(TODAY(), 2)
)
RETURN
CALCULATE (
COUNTA( vw_community_care_cancellation_report[bookingid] ),
FILTER ( ALLSELECTED (vw_community_care_cancellation_report ), (vw_community_care_cancellation_report[weeknumber] = PreviousWeek )
))
This measure uses a variable PreviousWeek to store the maximum value of weeknumber in the table that is less than the current week number (as calculated by the WEEKNUM function). Then, it uses that variable in the FILTER function to return the count of bookingid for the previous week. This will give you a different value than the second measure, which calculates the count of bookingid for the current week.
It looks like both measures are returning the same value because they are calculating the count of bookingid in the same context (i.e., the same filter is applied to the vw_community_care_cancellation_report table in both measures). The first measure is using a variable CW to store the maximum value of weeknumber in the table, and then using that variable in the FILTER function to return the count of bookingid for that week. The second measure is using the WEEKNUM function to get the current week number (relative to the first week of the year), and then using that value in the FILTER function to return the count of bookingid for that week. Since both measures are effectively doing the same thing (counting the number of bookingid for the current week), they will return the same value.
To fix the problem, you will need to modify the measures to calculate different values. For example, you could modify the first measure to calculate the count of bookingid for the previous week instead of the current week. Here is one way you could do that:
CW Cancellations =
VAR PreviousWeek =
CALCULATE (
MAX ( vw_community_care_cancellation_report[weeknumber] ),
ALLSELECTED (vw_community_care_cancellation_report ),
vw_community_care_cancellation_report[weeknumber] < WEEKNUM(TODAY(), 2)
)
RETURN
CALCULATE (
COUNTA( vw_community_care_cancellation_report[bookingid] ),
FILTER ( ALLSELECTED (vw_community_care_cancellation_report ), (vw_community_care_cancellation_report[weeknumber] = PreviousWeek )
))
This measure uses a variable PreviousWeek to store the maximum value of weeknumber in the table that is less than the current week number (as calculated by the WEEKNUM function). Then, it uses that variable in the FILTER function to return the count of bookingid for the previous week. This will give you a different value than the second measure, which calculates the count of bookingid for the current week.
Hi @Ved_Prakash
can you provide a screenshot of the results that you are getting?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
44 | |
25 | |
19 | |
16 | |
8 |
User | Count |
---|---|
70 | |
49 | |
45 | |
20 | |
16 |