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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sinanalmac
Resolver I
Resolver I

Count month according to the measures

 Hi all, I 'm trying to create a measure with month  but this  shows a different value 

The calculations are the same between two tables but when I turn the table to a card it changes. I don't understand why?

 if you what  you can find the file in the link
https://www.dropbox.com/sh/rrcmf97oupdb3fr/AAAEW6-mDPVOjc6k5WBKS90ba?dl=0

count of value.png

Here is my calculation. they are also very simple. 

 
1- For targets : if the values are between  +- target values  it  types 1 

IF(AND('FORECAST BIAS'[BIAS]<MAX('Category Target'[ForecastBias Target]);'FORECAST BIAS'[BIAS]>(-MAX('Category Target'[ForecastBias Target])));1;0)
SUBCATTARGET = IF(AND('FORECAST BIAS'[BIAS]<MAX('SubcategoryTarget'[ForecastBias Target]);'FORECAST BIAS'[BIAS]>(-MAX('SubcategoryTarget'[ForecastBias Target])));1;0)
COUNTRY TARGET = IF(AND('FORECAST BIAS'[BIAS]<MAX('Country Target'[ForecastBias Target]);'FORECAST BIAS'[BIAS]>(-MAX('Country Target'[ForecastBias Target])));1;0)


2-Targets calcultion:  this code for  selection. It understands which filter is selected. 

CALCULATION TARGET = IF(ISBLANK(SELECTEDVALUE('FORECAST BIAS'[Category ]))=FALSE();IF(ISBLANK(SELECTEDVALUE('FORECAST BIAS'[SubCategory]))=FALSE();'FORECAST BIAS'[SUBCATTARGET];'FORECAST BIAS'[CATEGORYTARGET]);'FORECAST BIAS'[COUNTRY TARGET])

3- ad the last one : IF calculation target is 1 show then show  the month 

Measure 2 = CALCULATE(DISTINCTCOUNT('FORECAST BIAS'[ Month ]);FILTER('FORECAST BIAS';'FORECAST BIAS'[CALCULATION TARGET]=1))

I want to count how many months' values are one.

Thank you for helping me

Best Regards 
Sinan 

1 ACCEPTED SOLUTION
themistoklis
Community Champion
Community Champion

@sinanalmac

 

try this for measure2:

 

Measure 2 = CALCULATE(DISTINCTCOUNT('FORECAST BIAS'[ Month ]), FILTER(ALL('FORECAST BIAS'[ Month ]),'FORECAST BIAS'[CALCULATION TARGET]=1))

View solution in original post

3 REPLIES 3
themistoklis
Community Champion
Community Champion

@sinanalmac

 

try this for measure2:

 

Measure 2 = CALCULATE(DISTINCTCOUNT('FORECAST BIAS'[ Month ]), FILTER(ALL('FORECAST BIAS'[ Month ]),'FORECAST BIAS'[CALCULATION TARGET]=1))

Hi @themistoklis   ,

dude,  you are a life saver Thank you  so much .That's what I need Heart

Best regards

Sinan

 hi    @themistoklis
thank you  I wil check  it 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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