Forum Discussion
Gross + If
Hi All!
I have this measure:
Gross USD=CALCULATE( DIVIDE( SUM( 'DB 2021'[Gross USD] ), COUNTROWS( 'Date' ) ),
keepfilters( 'Date'[Date] < TODAY()))
And I want to put the following condition into it:
If the Source = "Amn" then bring me both Gross USD and Fee
Otherwise just bring me Gross USD
Thanks for the helpers!
Hi netanel ,
You can try below code:-
Gross USD = IF ( SELECTEDVALUE ( 'Table'[Source] ) = "Amn", CALCULATE ( DIVIDE ( ( SUM ( 'DB 2021'[Gross USD] ) + SUM ( 'DB 2021'[Fee] ) ), COUNTROWS ( 'Date' ) ), KEEPFILTERS ( 'Date'[Date] < TODAY () ) ), CALCULATE ( DIVIDE ( SUM ( 'DB 2021'[Gross USD] ), COUNTROWS ( 'Date' ) ), KEEPFILTERS ( 'Date'[Date] < TODAY () ) ) )Thanks,
Samarth
4 Replies
- ValtteriN
Community Champion
Hi,
You can include IF to your Fee measure. So something like this
Measure = IF(SELECTEDVALUE('Table'[Source])<>"Amn",BLANK(),[FEE])
With this the measure will display blank if the Source is something besides Amn. I hope this helps and if it does consider accepting this as a solution and giving the post a thumbs up!- ValtteriN
Community Champion
Hi,
Then you can just use the same logic with that column:
Measure = IF (SELECTEDVALUE ('Table' [Source]) <> "Amn", BLANK (), SELECTEDVALUE('Table'[FEE]))
- Samarth_18
Community Champion
Hi netanel ,
You can try below code:-
Gross USD = IF ( SELECTEDVALUE ( 'Table'[Source] ) = "Amn", CALCULATE ( DIVIDE ( ( SUM ( 'DB 2021'[Gross USD] ) + SUM ( 'DB 2021'[Fee] ) ), COUNTROWS ( 'Date' ) ), KEEPFILTERS ( 'Date'[Date] < TODAY () ) ), CALCULATE ( DIVIDE ( SUM ( 'DB 2021'[Gross USD] ), COUNTROWS ( 'Date' ) ), KEEPFILTERS ( 'Date'[Date] < TODAY () ) ) )Thanks,
Samarth