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
navafolk
Helper III
Helper III

If returns multiple values

Hi pros,

I my Transaction table is as following:

DateTypeAmount
01/01/2020local secured fund100
01/01/2020local unsecured fund50
01/01/2020global secure fund150
01/01/2020global unsecured fund100

I would like to sum up Transaction to Summary table (expected as below) without creating any support column:

- Sum 'local secured fund' and 'local unsecured fund' to mother group 'local fund'

DateSum_typetotal
01/01/2020local fund150
01/01/2020global fund250

I cannot use if function (if x is true, return to multiple values: a, b) to sumif in Summary[total]:

=CALCULATE(SUM('Transaction'[Amount] ),
   FILTER(ALL('Transaction'),
      'Transaction'[Date] ='Summary'[Date],
      &&'Transaction'[Type]=if('Summary'[Sum_type]="local fund",{"local unsecured fund","local secured fund"},'Daily schedule'[Account type])))
 
Any ideal? Please help, thank you very much.
1 ACCEPTED SOLUTION

@navafolk ,

if need two measure the try


global amount =
sumx(filter('Transaction',search("global",Table[Type],,0)>0),'Transaction'[Amount])


local amount =
sumx(filter('Transaction',search("local",Table[Type],,0)>0),'Transaction'[Amount])

 

Else check binning can help

https://radacad.com/grouping-and-binning-step-towards-better-data-visualization

View solution in original post

4 REPLIES 4
navafolk
Helper III
Helper III

Thank you guys @amitchandak and @v-shex-msft ,

It would be great if we can calculate directly without supporting column/table.

I can calculate sum with IN statement: 

=CALCULATE(SUM('Transaction'[Amount] ),
   FILTER(ALL('Transaction'),
      'Transaction'[Type] IN {"local unsecured fund","local secured fund"}))
 
Is there any way that I can put this IN function into a conditional formual like: if true returns function IN {"local unsecured fund","local secured fund"}? I am not familiar with DAX syntax 😄

@navafolk ,

if need two measure the try


global amount =
sumx(filter('Transaction',search("global",Table[Type],,0)>0),'Transaction'[Amount])


local amount =
sumx(filter('Transaction',search("local",Table[Type],,0)>0),'Transaction'[Amount])

 

Else check binning can help

https://radacad.com/grouping-and-binning-step-towards-better-data-visualization

v-shex-msft
Community Support
Community Support

Hi @navafolk,

I'd like to suggest you add a calculated column to extract category from type field, then you can simply use date value and new category column to create a table visual with aggregate amount values.

Category = 
VAR _start =
    LEFT ( [Type], SEARCH ( " ", [Type], 1, -1 ) - 1 )
VAR _end =
    RIGHT (
        [Type],
        LEN ( [Type] )
            - SEARCH ( " ", [Type], SEARCH ( " ", [Type], 1, -1 ) + 1, -1 )
    )
RETURN
    _start & " " & _end

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
amitchandak
Super User
Super User

@navafolk ,

Try to create a new table like

New table =
summarize(selectcolumns(Table, "Date",Table[Date],"Sum_type" , if(search("global",Table[Type],,0)>0,"global fund","local fund"), "_total",Table[Amount]),[Date],[Sum_type], "Total",[_total])

 

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.