3 Tips to use SUMX() in Power BI — Ways to Master DAX

3 ways to use SUMX() in DAX.

There are 3 common ways to use SUMX().

  1. Calculate distincount.
    By using SUMX() to calculate distinct count, would get better performance.
    [1.不重複計數#]= SUMX(VALUES(_retail_table[seq],1)
  2. Calculate Sales Amount.
    By using SUMX() would calculate value row by row, then sum up result at end. This is also the classic way to use SUMX().
    [2.銷額加總#] = SUMX(_retail_table, [sales_price] * [qty])
  3. Condition Calculate with VAR.
    This would be a advanced tip to use.
    By calculate condition criteria row by row, then sum up result at end.
    [3.條件銷額加總#] =
    SUMX(_retail_table,
    VAR _sales_price = [sales_price]
    Return
    SWITCH(TRUE()
    , _sales_price >2, [sales_price] * [qty]
    , 0
    )

Learn more from my LinkedIn if you also interest in Power BI and DAX.

--

--

--

Data analyst focus on OMO retail marketing strategy. Familiar with Power BI, Python and SQL. https://www.LinkedIn.com/in/FrankLinty

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Hacking Series Part 2

Marvel vs DC Data Analysis in Python

Implementing backlinks in a Hugo website

Best Base64 Decode & Encode Online Tool | Free & Easy to Use

Base64 Decode Online, base64 encode online, base64 converter, base64 online convert, www.Base64DecodeOnline.com

Faster purchasing through software development

(neo)Vim, Codi & PHP

Simple Android Chat Application using FirestoreRecyclerAdapter

Cascading style sheets In Web Development

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Frank Lin TY

Frank Lin TY

Data analyst focus on OMO retail marketing strategy. Familiar with Power BI, Python and SQL. https://www.LinkedIn.com/in/FrankLinty

More from Medium

How do Relationships differ from Joins in Business Intelligence tools?

What’s the Difference Between Data Analytics and Data Analysis?

Want to Deploy a Successful Dashboard? Ask These 3 Questions First.

Email — your friendly neighbourhood Analytics reporting platform (Part 1)