Forum Discussion

sixtoquiles's avatar
sixtoquiles
Helper II
9 years ago
Solved

Help with this...

HI Everyone....

 

I have this table in my PowerBI (am using direct query) the original table is much bigger, this just a sample,

 

And i need to create a measure to:

            How many Customer by District by Date

            In target district, each target for each distric

            I need to sum how many customer and sum each target to make a gauge.

 

I got this in PwerBI

 

  • Ooops,

     

    I cut and paste the wrong measure in

     

    Please try this

     

    Measure2 = IF(
    			HASONEVALUE(
    				'Table1'[Target]
    				),
    				MAX(Table1[Target]),
    				SUMX(
    					SUMMARIZE(
    					'Table1',Table1[Date],Table1[District],
    					"Max Per Day",MAX('Table1'[Target])),[Max Per Day])
    					)
  • Oh yeah, that's not ideal

     

    Please try this slight tweak  :)

     

    Measure2 = IF(
    				ISFILTERED(
    					'Table1'[Target]
    					),
    					MAX(Table1[Target]),
    					SUMX(
    						SUMMARIZE(
    						'Table1',Table1[Date],Table1[District],
    						"Max Per Day",MAX('Table1'[Target])),[Max Per Day])
    					)

14 Replies

  • Phil_Seamark's avatar
    Phil_Seamark
    Microsoft Employee

    Hi sixtoquiles

     

    I created some simple calculated measures using the following forumlas

     

    Count CustID = CALCULATE(DISTINCTCOUNT(Table1[CustomerID]))
    
    Target District = CALCULATE(MAX(Table1[Target]))

    But equally you might be able to achieve it by dragging the feild to the visual and setting the aggreation to be Count (Distinct)