Giter Club home page Giter Club logo

power-bi-dax-cheatsheet's Introduction

Power BI DAX Cheatsheet


Format Strings and Integers

  1. FORMAT(value, ""): Produces string
-532.00 -> -532
0.32 -> 0.32
  1. FORMAT(value, "0"): Produces string
-532.00 -> -532
0.32 -> 0
  1. FORMAT(value, "0.0" ): Produces string
-532.00 -> -532.0
10.26 -> 10.3

NOTE: All upper formula produces a string as final result. Can not be sorted as an integer. To sort as an integer, select measure under "measure tools" section, select dynamic in format dropdown.
Important Note: # is for optional place holder and 0 is compulsory place holder. 5. 0.0: Produces integer

-532.00 -> -532
0.32 -> 0.32
  1. "00.00": Produces integer
3.2 -> 03.20
  1. "#.#": Produces integer
-532.00 -> -532
0.32 -> .3
10.00 -> 10

Add Commas to integer:
8. "#,K":

-532.0 -> -532K
0.32 -> K
1,243.00 -> 1243K
  1. "#,.K":
10.26 -> K
1,243.00 -> 1K
143,498.00 -> 143K
  1. "0,.#K": Two commas are million, one comma is thousand, 3 = Billion
-532.00 -> -0.5K
10.26 -> 0K
1,243.00 -> 1.2K
  1. "#%":
0.32 -> 32%
2.00 -> 200%
1,243.00 -> 124300%
  1. "$0,#.#":
-532 -> -$532
10.26 -> $10.3
1,243 -> $1,243
  1. "$0,#.#;($0,#.#);zero":
-532.00 -> ($532)
10.26 -> ($10.3)
0.00 -> zero

Format Dates:

  1. FORMAT(MAX(dateTable[DateColumn), "0"):
15 February 2023 -> 44972
  1. FORMAT(MAX(dateTable[DateColumn), "dd mm yyyy"):
15 February 2023 -> 15 02 2023
  1. FORMAT(MAX(dateTable[DateColumn), "dd/mm/yyyy"): / or " " or "-" are just separators. Any can be used.
15 February 2023 -> 15/02/2023

NOTE: "mmm" -> Jan; "m" -> 1 (and not 01), 12; d -> 1 (and not 01),12; ddd -> Thu, Sun; "q" (->1,2,3,4) gives quarter in which the date belongs to, can be combined with date, month, year. "\Qq" -> Q1,Q2,Q3,Q4.

power-bi-dax-cheatsheet's People

Contributors

rohit318 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.