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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Total of Measure Incorrect

Hello,

 

I have this table,

 

Capture222.PNG

 

 but the total is wrong (its missing the 120 +120 to equal 3205 for Tax Place holder and 2592 for Cash Place holder)

 

My measures are:

 

Tax Place Holder = IF(ISBLANK(SUM('Pi Data'[Taxes])),5*24,SUM('Pi Data'[Taxes]))

 

and 

 

Cash Place Holder = 18*24.
 
Note: [Cash Place Holder] is just for showing what the problem is. It seems that it should be like SUM(18*24)
 
My objective is to have [Tax Place Holder] have the correct total. Whenever there is not a value for that day, it is to insert 5*24.
 
 
Here is my data:
 
 
DateTaxes
10/2/2016 0:00635.802
10/3/2016 0:00649.527
10/6/2016 0:00827.314
10/4/2016 0:00852.5352
 
 
Note that 9/30 and 10/1 do not exist in my table with taxes, but the place holder would have values for these dates from a calendar table.
 
Any thoughts?
 
Thanks!
 
1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @Anonymous

create measures

blank_flag = IF(SUM('Pi Data'[Taxes])=BLANK(),1,0)

Tax Place Holder2 =
VAR count_blank =
    COUNTX ( FILTER ( ALLSELECTED ( 'date' ), [blank_flag] = 1 ), [blank_flag] )
VAR tax1 =
    IF ( ISBLANK ( SUM ( 'Pi Data'[Taxes] ) ), 5 * 24, SUM ( 'Pi Data'[Taxes] ) )
RETURN
    IF (
        HASONEVALUE ( 'date'[Date] ),
        tax1,
        CALCULATE ( SUM ( 'Pi Data'[Taxes] ), ALLSELECTED ( 'date'[Date] ) )
            + 120 * count_blank
    )

Cash Place Holder2 = var sum1=18*24 return IF(HASONEVALUE('date'[Date]),sum1,SUMX(ALLSELECTED('date'),sum1))

2.png

 

Best Regards

Maggie

View solution in original post

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @Anonymous

create measures

blank_flag = IF(SUM('Pi Data'[Taxes])=BLANK(),1,0)

Tax Place Holder2 =
VAR count_blank =
    COUNTX ( FILTER ( ALLSELECTED ( 'date' ), [blank_flag] = 1 ), [blank_flag] )
VAR tax1 =
    IF ( ISBLANK ( SUM ( 'Pi Data'[Taxes] ) ), 5 * 24, SUM ( 'Pi Data'[Taxes] ) )
RETURN
    IF (
        HASONEVALUE ( 'date'[Date] ),
        tax1,
        CALCULATE ( SUM ( 'Pi Data'[Taxes] ), ALLSELECTED ( 'date'[Date] ) )
            + 120 * count_blank
    )

Cash Place Holder2 = var sum1=18*24 return IF(HASONEVALUE('date'[Date]),sum1,SUMX(ALLSELECTED('date'),sum1))

2.png

 

Best Regards

Maggie

Anonymous
Not applicable

Thanks! it works. Crazy that it needs to be that complicated haha!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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