Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Ved_Prakash
Frequent Visitor

Curren week measure

both the measure are returning same value throughout the column, please correct

 

CW Cancellation =
VAR CW =
    CALCULATE ( MAX ( vw_community_care_cancellation_report[weeknumber] ), ALLSELECTED (vw_community_care_cancellation_report ) )
RETURN
    CALCULATE (
        COUNTA( vw_community_care_cancellation_report[bookingid] ),
        FILTER ( ALLSELECTED (vw_community_care_cancellation_report ), (vw_community_care_cancellation_report[weeknumber] = CW )
    ))
 
CW Cancellations = CALCULATE( COUNTA( 'vw_community_care_cancellation_report'[bookingid] ), FILTER( ALL( 'vw_community_care_cancellation_report' ), 'vw_community_care_cancellation_report'[weeknumber] = WEEKNUM( TODAY(), 2 ) ) )
1 ACCEPTED SOLUTION
tmack99
Advocate II
Advocate II

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.

 



 

View solution in original post

2 REPLIES 2
tmack99
Advocate II
Advocate II

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.

 



 

tamerj1
Super User
Super User

Hi @Ved_Prakash 

can you provide a screenshot of the results that you are getting?

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.