Forum Discussion
Userelationship connection with second relation
I have BlanksRowTable table
Blank
1
..
12
which has relation with Date table Month field
BlanksRowTable[Column1] -> Date[Month]
Table[date] has inactive relation with Date[date]
Clustered columns chart Visual has in Axis BlanksRowTable[Column1]
So when Table[date] Active relation with Date[date] everithing works good and i see Blanks in visual
194 =
CALCULATE (
SUM ( 'Table'[Sum] ),
FILTER (
ALL('Table'),
'Table'[State] IN { "on", "edit" } &&
ISBLANK('Table'[date])
)
)
But when Table[date] has inactive relation with Date[date]
and i use userelationship
194 =
CALCULATE (
SUM ( 'Table'[Sum] ),
USERELATIONSHIP('Table'[date],'Date'[date]),
FILTER (
ALL('Table'),
'Table'[State] IN { "on", "edit" } &&
ISBLANK('Table'[date])
)
)
i dont see blank anymore in visual
So how to fix that?
Hi Analitika ,
We create a new date table to be a slicer that has no relationship with other tables.
We need to create a measure to control the Axis. Put the measure to Filters on this page, like following screenshot.
Measure = var _sel = MAX('Date table'[Date]) var _month = MONTH(_sel) return IF(MAX(BlanksMonths[Column1])<=_month,1,0)Then we can create a Date2_measure you can refer.
Date2_measure = VAR _sel = MAX ( 'Date table'[Date] ) VAR _month = MONTH ( _sel ) VAR _date2 = CALCULATE ( SUM ( 'Table'[Sum] ), USERELATIONSHIP ( 'Date'[Date], 'Table'[Date2] ), 'Table'[State] IN { "5", "6" } ) VAR _date2_blank = CALCULATE ( SUM ( 'Table'[Sum] ), USERELATIONSHIP ( 'Date'[Date], 'Table'[Date2] ), 'Table'[State] IN { "5", "6" }, ISBLANK ( 'Table'[Date2] ), ALL ( 'BlanksMonths' ) ) VAR _date2_all = CALCULATE ( SUM ( 'Table'[Sum] ), USERELATIONSHIP ( 'Date'[Date], 'Table'[Date2] ), 'Table'[State] IN { "5", "6" }, BlanksMonths[Column1] <= _month ) VAR _date3_last = CALCULATE ( SUM ( 'Table'[Sum] ), USERELATIONSHIP ( 'Date'[Date], 'Table'[Date3] ), 'Table'[State] IN { "5", "6" }, BlanksMonths[Column1] = _month ) RETURN IF ( MAX ( BlanksMonths[Column1] ) = _month, _date2_all + _date2_blank + _date3_last, _date2 )The result like this,
If it doesn't meet your requirement, please kindly ask here and we will try to resolve it.
BTW, pbix as attached.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
6 Replies
- amitchandak
Super User
Analitika , Try with +0
194 = CALCULATE ( SUM ( 'Table'[Sum] ), USERELATIONSHIP('Table'[date],'Date'[date]), FILTER ( ALL('Table'), 'Table'[State] IN { "on", "edit" } && ISBLANK('Table'[date]) ) ) +0Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
- Analitika
Post Prodigy
Here i create new file, but now cant reproduce blanks 😞
need change axis type to categorical, then blanks is showing, but removefilter is not working now 😫
- v-zhenbw-msft
Community Support
Hi Analitika ,
We can use two ways to meet your requirement.
The first way is to create three measures.
1. Create three column charts and use BlanksMonths[Column1] to be the Axis.
Date1_measure = CALCULATE ( SUM ( 'Table'[Sum] ), FILTER ( 'Table', 'Table'[State] IN { "5", "6" } ) )Date2_measure = CALCULATE ( SUM ( 'Table'[Sum] ),USERELATIONSHIP('Date'[Date],'Table'[Date2]),'Table'[State] in { "5","6"})Date3_measure = CALCULATE ( SUM ( 'Table'[Sum] ),USERELATIONSHIP('Date'[Date],'Table'[Date3]),'Table'[State] in { "5","6"} )2. We need to change the X Axis type to Categorical, then we can see the blank.
The second way it two create three month columns based on Table[Date], Table[Date2] and Table[Date3].
1. Create three date month column in Table.
Date1_Month = MONTH('Table'[Date1])Date2_month = MONTH('Table'[Date2])Date3_month = MONTH('Table'[Date3])2. Then we can create three column charts based on the three month columns, and put the Table[Sum] in Values.
And put the Table [State] in Filter on this page. Also we need to configure the X axis to Categorical.
If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?
BTW, pbix as attached.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.