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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
PatrickF2002
Regular Visitor

Adding 0's to power BI Data

So essentially, I have a set of data for a store that includes cash registers 1-15, with the numerical amount of transactions that occur at these registers for each hour they are operational. My problem is that when there is 0 transactions for a given register in a given hour, instead of showing 0 for that register in that hour, nothing appears. I need to find a way to make those 0's appear for the given register # when no transactions occur.

10 REPLIES 10
Kishore_KVN
Super User
Super User

Hello @PatrickF2002 at the end of your measure write +0 to get the values as '0' whereever the data is not available. 

 

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

ray_aramburo
Super User
Super User

Assuming the numerical amount of transactions is a Count function, create a measure: 

TransactionsCount = 

var tcount = COUNT(Table[TransactionID])

RETURN

IF(ISBLANK(tcount), 0, tcount)




Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





Im going to include an example image from data view to help explain my issue a little betterTrx Example Image.png

registers 2-8 have txn’s in the txn column

-registers 1 and 9 do not have txn’s in the txn column, and so they are not showing up in the data set at hour 13.

-registers 1 and 9 should be included in the data set at hour 13, with the number 0 in the txns column for both respectively

So, do you want to add register 1 and 9 as rows into your source table?





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





They are already in the source table, however they do not appear because no trnxs are occuring at them during hour 13. I want to make it so that they appear with 0's in the trnx column.

Then just create a measure as suggested above by myself or @Kishore_KVN and add it to a table visual.





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





I'll give it a try, would you be able to show me an example of the measure using the column headers from the data example I provided?

TransactionsCount = 

var tcount = COUNT('Insert your table name here'[register_id])

RETURN

IF(ISBLANK(tcount), 0, tcount)

 

After created add all those columns to the table visual plus the created measure (this created measure would replace txns column)





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





So I tried your formula, and I got an error reading this-Trxn Formula Error.png

 Any advice on how to fix?

First write the measure name then Alt + Enter and write the var line, then instead of an =, write a RETURN.

Also, instead of ISBLANK(vregister_count[txns]) write it as (ISBLANK(tcount))

See example here:

TransactionsCount = 

var tcount = COUNT('Insert your table name here'[register_id])

RETURN

IF(ISBLANK(tcount), 0, tcount)

 





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.