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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
tools12345
Helper I
Helper I

How to set value in card based on week value

Hi everyone here in the community, we would like to ask for your insights and help, we have a specific card and a slicer with week. One requirement is that we should be able to display the current week amount on the card and once we select a week on the slicer, It will also display the week amount accordingly. Tried to create a measure but it shows the amount based on the maximum or last week on the table, and not on the current week. Below image and attach is the sample pbix file for testing. Thank you!! sample file powerbi card.png

 

 

2 ACCEPTED SOLUTIONS
tamerj1
Super User
Super User

Hi @tools12345 
Here is th sample file with the solution https://we.tl/t-NAIGSrO6ds

1.png2.png3.png

 

Selected Week Value = 
VAR SelectedWeek = COALESCE ( SELECTEDVALUE ( data1[Week] ), WEEKNUM ( TODAY ( ) ) - 1 )
VAR Result =
    CALCULATE ( 
        SUM ( data1[Account Payables] ),
        data1[Week] = SelectedWeek
    )
RETURN
    COALESCE ( Result, 0 )

 

View solution in original post

Hi,

Thank you very much for your message.

Please try the below measure for replacing Blank with zero.

 

expected outcome: = 
VAR _thisweeknumber =
    WEEKNUM ( TODAY (), 21 )
RETURN
    IF (
        ISFILTERED ( date_2022[Week of Year] ),
        SUM ( data1[Account Payables] ),
        CALCULATE (
            SUM ( data1[Account Payables] ),
            FILTER ( data1, data1[Week] = _thisweeknumber )
        )
    ) + 0

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

8 REPLIES 8
tamerj1
Super User
Super User

Hi @tools12345 
Here is th sample file with the solution https://we.tl/t-NAIGSrO6ds

1.png2.png3.png

 

Selected Week Value = 
VAR SelectedWeek = COALESCE ( SELECTEDVALUE ( data1[Week] ), WEEKNUM ( TODAY ( ) ) - 1 )
VAR Result =
    CALCULATE ( 
        SUM ( data1[Account Payables] ),
        data1[Week] = SelectedWeek
    )
RETURN
    COALESCE ( Result, 0 )

 

Hi @tamerj1 thank you so much! The measure works fine! How can I change the BLANK to 0 value for weeks that don't have an amount instead? 

Hi @tools12345 
The original reply has been updated as per your requirement.

Thank you very much, sir @tamerj1! 🙏🏻 

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I fully understood the data model, but please try to write the below measure and put it into the card visualization.

Please check the below picture and the attached pbix file.

 

Picture2.png

 

expected outcome: =
VAR _thisweeknumber =
    WEEKNUM ( TODAY (), 21 )
RETURN
    IF (
        ISFILTERED ( date_2022[Week of Year] ),
        SUM ( data1[Account Payables] ),
        CALCULATE (
            SUM ( data1[Account Payables] ),
            FILTER ( data1, data1[Week] = _thisweeknumber )
        )
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thank you so much, Sir @Jihwan_Kim -- truly thankful and you've been one of the active pro I can reach out here in the community 🙇🏻‍♀️ The measure works fine! How can I change the BLANK to 0 value for weeks that don't have an amount instead? Thank you! 

Hi,

Thank you very much for your message.

Please try the below measure for replacing Blank with zero.

 

expected outcome: = 
VAR _thisweeknumber =
    WEEKNUM ( TODAY (), 21 )
RETURN
    IF (
        ISFILTERED ( date_2022[Week of Year] ),
        SUM ( data1[Account Payables] ),
        CALCULATE (
            SUM ( data1[Account Payables] ),
            FILTER ( data1, data1[Week] = _thisweeknumber )
        )
    ) + 0

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thank you very much, sir @Jihwan_Kim - really appreciate your help and insights! 🙇🏻‍♀️🙏🏻

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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