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
Anonymous
Not applicable

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_
)

Paulyeo11_0-1608773184095.png

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

My PBI file at above link.

 

Paul

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@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 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@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 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
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

lbendlin
Super User
Super User

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
Super User
Super User

@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?


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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