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 All,
I have a country table contains 3 country like India,US,UK
country | Decimal Place
IN 2
US 3
UK 4
while showing the values based on country wise i want display my sales amount with those decimals places only
how do i pass Decimal places values dynamically to my format Function
after sometime my country's table will grow
Could you please help me on this.
For now i used the below DAX:
Regards
Mallikarjun
@mallik999
The downside to this approach is the result is a text, allows no calculation. If you want to have it, 1st create a table of countries and their respective decimal places like below
Add a measure as follows:
New Value =
VAR COU = SELECTEDVALUE(Query1[Country])
VAR DEC = LOOKUPVALUE(CountryDemimal[Decimal],CountryDemimal[Country],COU,"0,0.00")
RETURN
IF( NOT ISBLANK(COU) ,
FORMAT(MAX(Query1[PRODUCT_VAL] ), DEC)
)
You will have the desired output and it is dynamic when more countries are added:
________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@mallik999 , See if a measure like this can help
//line level
Switch( True() ,
max(Query1[COUNTRY])="IN",FORMAT(Query1[PRODUCT_VAL],"0.00"),
Max(Query1[COUNTRY])="US",FORMAT(Query1[PRODUCT_VAL],"0.000") )
// based on selected value from slicer
Switch( True() ,
selectedValue(Query1[COUNTRY])="IN",FORMAT(Query1[PRODUCT_VAL],"0.00"),
selectedValue(Query1[COUNTRY])="US",FORMAT(Query1[PRODUCT_VAL],"0.000") )
I am facing same issue but this solution is not helping.
I am having a measure called Amount.
i want this measure to display value based on another column code.
if code is 0 no decimal value, if code is 1 one decimal value , if 2 then 2 values if 3 then 3.
i did this but seems not to be working :
oustanding_Amount:=Switch( True() ,
selectedValue(Test_code[code])=0,FORMAT([Amount],"0"),
selectedValue(Test_code[code])=1,FORMAT([Amount],"0.0"),
selectedValue(Test_code[code])=2,FORMAT([Amount],"0.00"),
selectedValue(Test_code[code])=3,FORMAT([Amount],"0.000"))
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 |