Forum Discussion
How to set value in card based on week value
- 4 years ago
Hi tools12345
Here is th sample file with the solution https://we.tl/t-NAIGSrO6dsSelected 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 ) - 4 years ago
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
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.
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 )
)
)
- tools123454 years ago
Helper I
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!
- Jihwan_Kim4 years ago
Super User
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- tools123454 years ago
Helper I
Thank you very much, sir Jihwan_Kim - really appreciate your help and insights! 🙇🏻♀️🙏🏻