Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
9 | |
8 | |
8 |
User | Count |
---|---|
14 | |
12 | |
11 | |
11 | |
8 |