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
Majidbhatti
Advocate IV
Advocate IV

HASONEVALUE adding BLANK row

I am trying to fix TOTALS of a Matrix but ending up with adding a BLANK row as shown in the image below

 

Screenshot 2020-12-24 201154.png

My measure is as below, I have values to replace 2, 3, 4, & 5 but keeping it simple here. Can you please help

Budget MTD = 
 If( HASONEVALUE(M_Hierarchy[L1]) ,
        SWITCH( SELECTEDVALUE ( M_Hierarchy[L1] ),
            "Rooms",
                2,
                3
        )
, 
        SWITCH( SELECTEDVALUE ( M_Hierarchy[L1] ),
            "Rooms",
                4,
                5
        )
)

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Issue Fix. There was problem in relations between tables

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Majidbhatti , Try a measure like

Budget MTD = sumx(values(M_Hierarchy[revenue]), // Use the correct table
If( HASONEVALUE(M_Hierarchy[L1]) ,
SWITCH( SELECTEDVALUE ( M_Hierarchy[L1] ),
"Rooms",
2,
3
)
,
SWITCH( SELECTEDVALUE ( M_Hierarchy[L1] ),
"Rooms",
4,
5
)
))

@mahoneypat , i wish it was that easy but BLANK is not showing in the visual filter

@amitchandak , All items are SUMXed which is blowing out the totals. 

See the problem below

Screenshot 2020-12-26 204230.png

 

 

Budget MTD (Rev) = 
Var vMonthDays = DATEDIFF( STARTOFMONTH(DateTable[Date]) , ENDOFMONTH(DateTable[Date])+1 , DAY )
Var vVal = CALCULATE(
                TOTALMTD([Actual Amount (AX)], DateTable[Date],AX_Data[Type] = "B") ,
                M_Hierarchy[L1Code] <> "9"
            ) 

Return

If( HASONEVALUE(M_Hierarchy[L1]) ,
    SWITCH( SELECTEDVALUE ( M_Hierarchy[L1] ),
        "Rooms",
            vVal,
        (vVal / vMonthDays ) * SELECTEDVALUE(DateTable[DAY])
        )
        ,
          //THIS SECTION IS THE PROBLEM  
          CALCULATE(
                TOTALMTD([Actual Amount (AX)], DateTable[Date],AX_Data[Type] = "B") ,
                M_Hierarchy[L1Code] <> "9"
            )
)

 

Issue Fix. There was problem in relations between tables

mahoneypat
Employee
Employee

In the Filter panel, highlight that visual and uncheck the Blank box for the Revenue column.  You could also do it with DAX with and AND or a nested IF, but that is easier.

Regards,

Pat





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

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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.