Forum Discussion
Lily780
3 years agoFrequent Visitor
Dax Measure return countrows with case statement (divide, substract)
Hi Experts, I have a truble with counting of rows in a measure. I have a table And this table has a relationship to Calendar table (Table.Order Date = Calendar.Date) I have a ta...
Anonymous
3 years agoNot applicable
Hi Lily780 ,
I created a sample pbix file(see attachment) for you, please check whether that is what you want. You can create a measure as below:
Flag =
VAR _selyear =
SELECTEDVALUE ( 'Calendar'[Year] )
VAR _ordate =
SELECTEDVALUE ( 'Table'[Order Date] )
VAR _interval =
SELECTEDVALUE ( 'Table'[Interval] )
VAR _ordyear =
YEAR ( _ordate )
VAR _ordmonth =
MONTH ( _ordate )
VAR _diff =
ABS ( _selyear - IF ( _ordmonth < 4, _ordyear - 1, _ordyear ) )
RETURN
IF (
_diff = 0
|| (
_interval > 0
&& IF ( _interval <> 0, MOD ( _diff, _interval ) ) = 0
),
1,
0
)
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following links to share the required info:
How to provide sample data in the Power BI Forum
How to Get Your Question Answered Quickly
And it is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community.
How to upload PBI in Community
Best Regards