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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Shree_185
Helper I
Helper I

DAX Calculated Column Help

Hi Everyone, 

 

Trying to replicate the below view in one line query (calculated column)

 

Calculate column = Region-wise Distinct Count ID  WHERE Date is not blank OR Date is not equal to 01/01/2000

 

 

Shree_185_0-1661884056645.png

Sample data :

Shree_185_1-1661884290988.png

To copy-paste sample data in Excel

RegionIDDate
CGCS001934-A-0011/1/2000
CGCS001935-A-0013/29/2021
CGCS002020-A-00210/18/2021
CGCS002027-A-0029/1/2021
CGCS002033-A-0029/21/2021
CGCS002034-A-0021/1/2000
CTXS000709-A-001 
CTXS001129-A-0016/3/2021
CTXS001136-A-0023/9/2022
CTXS001140-A-0016/22/2022
OPWS000761-A-0011/1/2000
OPWS000773-A-001 
OPWS000775-A-0018/17/2021
OPWS000784-A-0018/27/2021
OPWS000830-A-0017/23/2022
1 ACCEPTED SOLUTION

If you need the visual you posted, it should work. If you need it in a table visual, you need to add an ALLEXCEPT function in the filter expression:

Count ID ALLEXCEPT =
CALCULATE (
    DISTINCTCOUNT ( 'Table'[ID] ),
    FILTER (
        ALLEXCEPT ( 'Table', 'Table'[Region] ),
        NOT ( ISBLANK ( 'Table'[Date] ) )
            && 'Table'[Date] <> DATE ( 2000, 1, 1 )
    )
)

result.png

I've attached the sample PBIX file





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

3 REPLIES 3
PaulDBrown
Community Champion
Community Champion

Try:

Count ID =
CALCULATE(DISTINCTCOUNT(Table[ID), FILTER(Table, NOT(ISBLANK(Table[Date])) && Table[Date] <> DATE(2000, 1, 1)))





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






@PaulDBrown Thanks for your help. The logic didn't work? or maybe I did some mistake. can you please send me the PBIX file if possible?

If you need the visual you posted, it should work. If you need it in a table visual, you need to add an ALLEXCEPT function in the filter expression:

Count ID ALLEXCEPT =
CALCULATE (
    DISTINCTCOUNT ( 'Table'[ID] ),
    FILTER (
        ALLEXCEPT ( 'Table', 'Table'[Region] ),
        NOT ( ISBLANK ( 'Table'[Date] ) )
            && 'Table'[Date] <> DATE ( 2000, 1, 1 )
    )
)

result.png

I've attached the sample PBIX file





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.