Forum Discussion

ivancornejo_'s avatar
ivancornejo_
Frequent Visitor
8 years ago

Count blank in matrix

Hi, I have this matrix ->

 

 

I need count the blank spaces in a new column or use a measure. I tried a lot of possibles solutions from the forum, but a can't get a solution 

Help, please

 

Regards,

Iván.

 

PS: Sorry for my English

 

 

 

14 Replies

  • SteveCampbell's avatar
    SteveCampbell
    Memorable Member

    You can use a measure:

     

     

    Blank Count =
    CALCULATE(COUNTBLANK(Daily Stock[Units])
                        ,ALL(Daily Stock[Size])
    
    )

     

     

    This will count all blanks in all sizes

      • SteveCampbell's avatar
        SteveCampbell
        Memorable Member

        I am wondering if your values are truely blank. What do blank values appear as in the table?

        Can you try the measure:

        Contador := 
        CALCULATE(
        	COUNTROWS('Daily Stock')
        	,NOT('Daily Stock'[Units]>0)
        	,ALL('Daily Stock'[Size]))

         

  • Vvelarde's avatar
    Vvelarde
    Community Champion

    ivancornejo_

     

    Hi, please try these steps:

     

    1. Create a New Table Sizes: Modeling-New Table

     

     

    Sizes = VALUES(Table1[Size])

    2. Related to Original Table (In my case Table1)

     

     

    3. Create the nexts measures:

     

     

    AllSizes = COUNTROWS(ALLSELECTED(Table1[Size]))

     

    SizeAvalaible = COUNTROWS(VALUES(Table1[Size]))
    NoSizeAvailables-Total = SUMX(VALUES(Table1[Article]),CALCULATE([AllSizes]-[SizeAvalaible]))

    4. Create the Matrix

     

     

     

     

     

    Showing the measures AllSizes and SizeAvailable only to demostration purpose.

     

    5. Use a card with the measure:  NoSizesAvailable-Total

     

    Regards

     

    Victor

    Lima - Peru

     

     

    • ivancornejo_'s avatar
      ivancornejo_
      Frequent Visitor

      Thanks Vvelarde

      I follow your step and I get this,

       But when I change 

      AllSizes = COUNTROWS(ALLSELECTED(Table1[Size]))   --> AllSizes = COUNTROWS(ALLSELECTED(Size[size]))

      Matrix show this,

       

      As you can see, Total for (NoSizeAvailable-Total) is correct, I have 8 Articles in Blank , but the others numbers are incorrect 

      and the same with the others measures :/ 

      • SteveCampbell's avatar
        SteveCampbell
        Memorable Member

        Did you try changing 

        Contador :=   
        	if(
        		COUNTROWS('Article')*COUNTROWS(Size)-COUNTROWS('Stock Price')<1,
        			0,
        			COUNTROWS('Article')*COUNTROWS(Size)-COUNTROWS('Stock Price')
        		)

        What was the result? If you could send a the pbix file that would help a lot, depending on the data