Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

How to make total amount display ?

Hi All

I have a expression , when i use this for table , it does not able to display the total amount  :-

NEW ACC =
VAR sales2018_ =
CALCULATE ( SUM ( SALES[sales] ), 'Date'[Year] = 2018 )
VAR sales2019_ =
CALCULATE ( SUM ( SALES[sales] ), 'Date'[Year] = 2019 )
VAR sales2020_ =
CALCULATE ( SUM ( SALES[sales] ), 'Date'[Year] = 2020 )
RETURN
IF (
NOT ISBLANK ( sales2020_ ) && ISBLANK ( sales2019_ )
&& ISBLANK ( sales2018_ )
&& (
SELECTEDVALUE ( 'Date'[Year] ) = 2020
|| NOT ISFILTERED ( 'Date'[Year] )
),
sales2020_
)

https://www.dropbox.com/s/lj8ar9t0nygorbv/PBT_V01029%20ASK.pbix?dl=0

My PBI file at above link.

 

Paul

  • Anonymous , When you use the selected value, In that case, if 2020 is selected then 2019 and 2018 will be blank as per your formula. In other cases, grand total does not have a year, which you are checking in the formula so, you will not get grand total. What are trying to achieve here 

4 Replies

  • is that expression a calculated column, or a measure?  You will want to apply context transforms as needed (for example by including an "ALL()"  filter etc)

  • AllisonKennedy's avatar
    AllisonKennedy
    Icon for Community Champion rankCommunity Champion

    Anonymous  This is because the SELECTEDVALUE function only works when there's only one value. You need to provide a row context for htis measure. I can't see exactly where the problem is from looking at your measure, but what are you trying to display? This looks more complicated than it needs to be?

  • Anonymous , When you use the selected value, In that case, if 2020 is selected then 2019 and 2018 will be blank as per your formula. In other cases, grand total does not have a year, which you are checking in the formula so, you will not get grand total. What are trying to achieve here 

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi All

      Thank you very one for feedback. look like it is not possible to display total new account sales amount.

      Paul