Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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"))
User | Count |
---|---|
25 | |
12 | |
8 | |
7 | |
7 |
User | Count |
---|---|
25 | |
12 | |
11 | |
10 | |
6 |