Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi Team,
I need to add number of zero dynamically into the calculations based on the max value (no of digits before decimal) point.
Dax Reference link: https://dax.do/3B3JEwkIK0m0P6/
Logic: For the below snapshot,
after getting no of digits then we need to use the same in below calculation (Dynamic zeros in red color below calculation)
Sample Query
"UnitPrice_Column",
FIXED ( [unit_Price], 2, 1 ) + 10000000 // 4249567 (i.e, Number Of Digits=7)
//Number of zeros = number of digits
,
"Sales_Column",
FIXED ( [Sales Amount], 2, 1 ) + 10000000 // 5371682 (i.e, Number Of Digits=7)
//Number of zeros = number of digits
I am using this query now
DEFINE
VAR Req_columns =
ADDCOLUMNS (
SUMMARIZECOLUMNS (
'Product'[Brand],
Customer[Occupation],
"unit_Price", CALCULATE ( SUM ( Sales[Unit Price] ) ),
"Salesamount", [Sales Amount]
),
"UnitPrice_Column",
FIXED ( [unit_Price], 2, 1 ) + 10000000 // 4249567 (i.e, Number Of Digits=7)
//We need to consider max value from [unit_Price] and addition with number of zeros
,
"Sales_Column",
FIXED ( [Sales Amount], 2, 1 ) + 10000000 // 5371682 (i.e, Number Of Digits=7)
//We need to consider max value(5371682) from [Sales Amount] and addition with number of zeros
)
EVALUATE
Req_columns
ORDER BY [Sales Amount] DESC
Thanks In Advance
Solved! Go to Solution.
@Anonymous , You can meausre like
M1 = maxx(summarize(allselected(sales), 'Product'[Brand],
Customer[Occupation] , "_1", CALCULATE ( SUM ( Sales[Unit Price] ) ) ) , [_1])
M2 = Power(10, len([M1]&"")
that will give you desired number
you can add code in summarize column too
@Anonymous , You can meausre like
M1 = maxx(summarize(allselected(sales), 'Product'[Brand],
Customer[Occupation] , "_1", CALCULATE ( SUM ( Sales[Unit Price] ) ) ) , [_1])
M2 = Power(10, len([M1]&"")
that will give you desired number
you can add code in summarize column too
User | Count |
---|---|
40 | |
26 | |
22 | |
16 | |
15 |
User | Count |
---|---|
54 | |
35 | |
18 | |
17 | |
15 |