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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Seb_89
New Member

DISTINCTCOUNT for invoice (context)

Hi,

 

I wloud like to have DISTINCTCOUNT for Invoce from coum name

I'm using this masure

Miara = CALCULATE(DISTINCTCOUNT(Sheet1[Name]))

 

 

And sems working

But when i put more columns is not For a1 i should still keep 3  DISTINCT

 

Seb_89_0-1695631549100.png

 

Thas my data

 

InvoiceNameWhat to do
a1Kamila
a1łukaszc
a1Agatab
b2Kamilb
b2łukaszb
c3Agatab
c3łukaszb
d4Agatab
 
 

 

 

4 REPLIES 4
v-rongtiep-msft
Community Support
Community Support

Hi @Seb_89 ,

Please refer to my pbix file to see if it helps you.

Create a measure.

Measure =
CALCULATE (
    COUNT ( 'Table'[Invoice] ),
    FILTER (
        ALL ( 'Table' ),
        'Table'[Invoice] = SELECTEDVALUE ( 'Table'[Invoice] )
    )
)

Or a column.

Column =
CALCULATE (
    COUNT ( 'Table'[Invoice] ),
    FILTER ( 'Table', 'Table'[Invoice] = EARLIER ( 'Table'[Invoice] ) )
)

 

vrongtiepmsft_0-1695780601559.png

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

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

 

 

 

Seb_89
New Member

i dont now i was clear.

 

I need to show for a1 = 3

 

Like this

 

Seb_89_0-1695638307738.png

 

 

But when i add next column in visualisation i have something diffrent.

 

Seb_89_1-1695638383886.png

as i said for a1 i need 3

nirali_arora
Resolver II
Resolver II

You have to add other columns to the measure too 

Miara = CALCULATE(DISTINCTCOUNT(Sheet1[Name]), Sheet1[Column1], Sheet1[Column2], Sheet1[Column3])

I add but dont working

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.