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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
larabraghetti
Helper II
Helper II

DAX: Count on date filtering with a measure

Dear All,

 

I hope someone can help me on this topic.

 

I have this Pivot Table:

Table1.JPG

Where:

  • Values=The distinctcount is done on the column KEY=LIMLOGN[Id-Data]&LIMLOGN[SEGMDESC]
  • Columns=[LvlCode]
  • Rows=[Id-Data]

 

Then I wrote the following measure:

Stranges =
VAR LVL1 =
CALCULATE(DISTINCTCOUNT(LIMLOGN[KEY]);LIMLOGN[LvlCode] = 1)
VAR LVL2 =
CALCULATE(DISTINCTCOUNT(LIMLOGN[KEY]);LIMLOGN[LvlCode] = 2)
VAR LVL3 =
CALCULATE(DISTINCTCOUNT(LIMLOGN[KEY]);LIMLOGN[LvlCode] = 3)
VAR LVLTOT =
CALCULATE(DISTINCTCOUNT(LIMLOGN[KEY]))
RETURN
IF(
IF(AND(LVL1>LVL2;LVL1>LVL3);LVL1;
IF(LVL2>LVL3;LVL2;LVL3))<LVLTOT;
"Y";
"N"
)

 

All works fine. And I have built the following Pivot Table:

Cattura.JPG

 

 

But now I need to filter the following table:

Cattura.JPG

 

Anno=Year

Mese=Month

I need to count only if the measure is N.

Is it possible in some way?

 

Please, let me know if you need further information. 
Thank you in advance!!!
Lara

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @larabraghetti,

 

You can use countax to get the count value of “N”:

Count of N = COUNTAX(FILTER('pivot Table',[Stranges]="N"),[Stranges] )

Screenshot:

Capture.PNG
 
If above is not help, can you provide the pbix file with some test data?

Regards,
Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @larabraghetti,

 

You can use countax to get the count value of “N”:

Count of N = COUNTAX(FILTER('pivot Table',[Stranges]="N"),[Stranges] )

Screenshot:

Capture.PNG
 
If above is not help, can you provide the pbix file with some test data?

Regards,
Xiaoxin Sheng

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.