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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
arifulice09
Helper I
Helper I

need to showing 0 when there is no value in data table

I have three table , two is dimension( DimUser, DimWeek)  and one is fact table(JC), I have created a simple measure( count(JC[userWeek])  for counting attendance per week , it is returning result ok, some user are not coming in entire week ( for user Eric Kinzer he not coming week 24 and 25 ) , I need to show 0 on that week. Please see the attached.pblm.PNG

4 REPLIES 4
Migasuke
Super User
Super User

Hi @arifulice09 ,
You can achieve that with IF statement.
Basiaclly you want to say something like this - if I receive blank result, replace it with zero.

Measure would look like this:
MyMeasure =
var _CountUsers = COUNT(JC[userWeek]) 

return
IF(ISBLANK(_CountUsers),0,_CountUsers))



If my answer was helpful please give me a Kudos or even accept as a Solution.

Let's connect on LinkedIn!

Thanks for your reply, when I am using your measure then those user are showing in matrix who are not coming in a single day in entire month, in this case no need to showing in matrix, user like  "Erica Mckenzie"  , who not coming in a single day in entire month please see tha ttached.pblm2.PNG

Hi @arifulice09 ,

 

My Sample is as below.

JC:

RicoZhou_1-1659410808185.png

DimWeek:

RicoZhou_2-1659410814572.png

DimUser:

RicoZhou_3-1659410820969.png

Please try this code to create a measure.

Attendance Per Week = 
VAR _SUMMARIZE =
    SUMMARIZE (
        ALL ( DimUser ),
        DimUser[User],
        "Count", CALCULATE ( COUNT ( JC[userWeek] ), ALL ( DimWeek ) )
    )
RETURN
    IF (
        COUNTAX ( FILTER ( _SUMMARIZE, [User] = MAX ( DimUser[User] ) ), [Count] )
            = BLANK (),
        BLANK (),
        COUNT ( JC[userWeek] ) + 0
    )

Result is as below.

RicoZhou_0-1659410753147.png

 

Best Regards,
Rico Zhou

 

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

Thanks for your kind reply, I  have already solved it using the help of ALL function 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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