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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ToNo87
Regular Visitor

Get value from a field based on another field

I have a table something like this

 

Value | Datetime (date)

2          12/12/2016

3          12/12/2016

2          12/12/2016

2          12/12/2016

4          12/12/2016

2          12/14/2016

 

What I want to do is to create a measure where I get a distinct count of the "value" datafield, based on the "Date" column where the date column is NOW - 1 month.

 

How do I acheive this? 

1 ACCEPTED SOLUTION
PavelR
Solution Specialist
Solution Specialist

Hi @ToNo87

 

create measure like

Distinctcount M-1 = CALCULATE(DISTINCTCOUNT(Table1[Value]);DATEADD(Table1[Date];-1;MONTH))

 

Regrds.

Pavel

View solution in original post

6 REPLIES 6
PavelR
Solution Specialist
Solution Specialist

Hi @ToNo87

 

create measure like

Distinctcount M-1 = CALCULATE(DISTINCTCOUNT(Table1[Value]);DATEADD(Table1[Date];-1;MONTH))

 

Regrds.

Pavel

I'm getting a warning that says "The syntax for ';' is incorrect. " (I am using Power BI Desktop). 🙂 

PavelR
Solution Specialist
Solution Specialist

It works fine. Maybe that when you have edited the formula you have also removed some bracket or something.

 

Regards.

Pavel

Thanks @PavelR

 

This is the error message I got:

The syntax for ';' is incorrect. (DAX(CALCULATE(DISTINCTCOUNT(Data[Value]);DATEADD(Data[Time];-1;MONTH)))).

 

this is the measure I added:

Distinctcount -1 = CALCULATE(DISTINCTCOUNT(Data[Value]);DATEADD(Data[Time];-1;MONTH))

 

Note that Data[Value] is hash id (text) and Data[Time] is date/time if that matters.

Vvelarde
Community Champion
Community Champion

@ToNo87

 

Try replacing ; by ,




Lima - Peru

It worked, thanks!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors