Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join 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.

Reply
JustinDoh1
Post Prodigy
Post Prodigy

How to apply logic to place 1 and 0 decimal place on numbers & dealing with null values?

I have uploaded my updated (1/30) PBIX file here.

 

Bottom is original question (1/29/2025):

Previously, I had wrapped one measure called "Average" inside another measure called "decimalFix":

 

Average = AVERAGEX(
            VALUES('Date'[DateFormat]),
                CALCULATE(
                [ClientD_M1]
                 )
            )
 
 
decimalFix =
             if(DISTINCTCOUNT('Date'[DateFormat])=1,
                        format([Average],"0"),
                        format([Average],"0.0")
                )
 
which made these possible (number with 1 decimal place as well as 0 decimal :
JustinDoh1_0-1738196743562.png

 

 

Due to performace issue of "Average" measure, I modified the "Average" measure to "AverageNew" as below:

 

AverageNew =
AVERAGEX(
    FILTER(
        SUMMARIZE(
            'Census',
            'Date'[DateFormat],
            "ClientD_M1", [ClientD_M1]
            ),
            [ClientD_M1] > 0
            ),
            [ClientD_M1]
)

 

 

Now, I am trying to apply the logic of "decimalFix" to "AverageNew" so that on the new visual (matrix), I would like to have both 0 and 1 decimal places.

For now,  each day's number is fine (with 0 decimal), but the 'Average Census' needs to show 1 decimal numbers.

JustinDoh1_2-1738197380840.png

 

How do I go about doing it?

 

Update (1/30/2025):

Sorry. I realized that I need to come up with a solution to treat rows with null data (because there is filter to limit data and there are more than 1 hierarchy of data):

JustinDoh1_0-1738274822375.png

 

Bottom measure would not work for the null data that is not showing in these date period:

 

decimalFixNew =
if(DISTINCTCOUNT(DimDate1[DateFormat])=1,
format([AverageNew],"0"),
format([AverageNew],"0.0")
)
 

So, requirement is how to get rid of those rows with blank value?

 

Thanks.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @JustinDoh1 

 

Thanks for the reply from Jihwan_Kim and bhanu_gautam .

 

JustinDoh1 , please try to create a measure as follows.

Measure = IF([decimalFixNew] <> BLANK(), 1, 0)

 

Put the measure into the visual-level filters, set up show items when the value is 1.

vxuxinyimsft_0-1738312428641.png

 

If another user's answer helped you, please mark their answer as the solution. This will help more users who are facing the same or similar difficulties. Thank you!

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
bhanu_gautam
Super User
Super User

@JustinDoh1 , Use this measure

 

decimalFixNew =
IF(
DISTINCTCOUNT('Date'[DateFormat]) = 1,
FORMAT([AverageNew], "0"),
FORMAT([AverageNew], "0.0")
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






@bhanu_gautam  Thank you so much for your help again. Sorry. I realized that my requirement has to be changed because initially, I had an issue with dealing with null value, and I thought placing on the measure "AverageNew" would meet the need. 

 

            [ClientD_M1] > 0
            ),
            [ClientD_M1]

 

And I wanted to ask to just deal with 1 decimal place.

 

Sorry. I presented the scenario which would not meet the issues on initial stage (having multiple hierarchy) yesterday. 

 

I have updated my content on the top with updated PBIX file attached here.

 

I realized that I need to come up with a solution to treat rows with null data:

JustinDoh1_0-1738275064586.png

How do I fix so that all of "Insurance" hierarchy would not show up?

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please try creating a new measure like below.

 

Jihwan_Kim_0-1738216448517.png

 

 

decimalFixNew = 
if(DISTINCTCOUNT('Date'[DateFormat])=1,
format([AverageNew],"0"),
format([AverageNew],"0.0")
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

@Jihwan_Kim 

Thank you so much for your help again. Sorry. I realized that my requirement has to be changed because initially, I had an issue with dealing with null value, and I thought placing on the measure "AverageNew" would meet the need. 

 

           [ClientD_M1] > 0
            ),
            [ClientD_M1]

 

And I wanted to ask to just deal with 1 decimal place.

Sorry. I presented the scenario which would not meet the issues on initial stage (having multiple hierarchy) yesterday. 

 

I have updated my content on the top with updated PBIX file attached here.

 

I realized that I need to come up with a solution to treat rows with null data:

JustinDoh1_0-1738275655942.png

How do I fix so that all of "Insurance" hierarchy would not show up?

Anonymous
Not applicable

Hi @JustinDoh1 

 

Thanks for the reply from Jihwan_Kim and bhanu_gautam .

 

JustinDoh1 , please try to create a measure as follows.

Measure = IF([decimalFixNew] <> BLANK(), 1, 0)

 

Put the measure into the visual-level filters, set up show items when the value is 1.

vxuxinyimsft_0-1738312428641.png

 

If another user's answer helped you, please mark their answer as the solution. This will help more users who are facing the same or similar difficulties. Thank you!

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@Anonymous FYI, I just created a new post related to performance issue. Thanks!

@Anonymous I would like to close this thread because I think what I am experiencing is more of performance issue. But, if you are able to help me to come up with a solution to modify the "decimalFixNew" with additional logic, please let me know. Thank you!

@Anonymous 

Thank you so much for your help.

Even though it works with a small dataset, when I applied into filter on my regular PBIX file (which has a data from year 2022), the visual crashes.

Is there anyway not to use filter but modify/add the logic on "decimalFixNew" by chance? Sorry for trouble..

I am also curious how I could minimize the size or group dataset.

I also experience that when I try on Bookmark, visual crashes more. I am wondering why?

Thanks!

@Jihwan_Kim , I didn't saw your response I was drafting one sorry for that


@JustinDoh1 , Go with this both are same




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.