March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I have the following date table :
Year | MonthFrom | MonthTo | Ordre | MonthNum |
2020 | Janvier | Janvier | 1 | 1 |
2020 | Février | Février | 2 | 2 |
2020 | Mars | Mars | 3 | 3 |
2020 | Avril | Avril | 4 | 4 |
2020 | Mai | Mai | 5 | 5 |
2020 | Juin | Juin | 6 | 6 |
2020 | Juillet | Juillet | 7 | 7 |
2020 | Août | Août | 8 | 8 |
2020 | Septembre | Septembre | 9 | 9 |
2020 | Octobre | Octobre | 10 | 10 |
2020 | Novembre | Novembre | 11 | 11 |
2020 | Décembre | Décembre | 12 | 12 |
2021 | Janvier | Janvier | 13 | 1 |
2021 | Février | Février | 14 | 2 |
2021 | Mars | Mars | 15 | 3 |
2021 | Avril | Avril | 16 | 4 |
2021 | Mai | Mai | 17 | 5 |
2021 | Juin | Juin | 18 | 6 |
2021 | Juillet | Juillet | 19 | 7 |
2021 | Août | Août | 20 | 8 |
2021 | Septembre | Septembre | 21 | 9 |
2021 | Octobre | Octobre | 22 | 10 |
2021 | Novembre | Novembre | 23 | 11 |
2021 | Décembre | Décembre | 24 | 12 |
I am sorting the MonthFrom and the MonthTo based on the MonthNum.
I have the following filters :
Only one selection option is activated in them.
I am creating this measure to prevent that the user selects a higher month in the FROM filter than the TO filter ;
Solved! Go to Solution.
It's normal since you are comparing two string columns I suppose, so the result remains the same.
You are comparing for example "January" to "January" the two strings are equal so you won't have the error message.
Try the following :
FromToMeasure = IF(SELECTEDVALUE('Sorted Calendar'[MonthNum]) > SELECTEDVALUE('Sorted Calendar'[MonthNum]), "Sélection invalide" , "")
The problem is that if you only use one table and this structure of slicers, the default behaviour will be to filter the table with and AND condition. In other words, if you select January in MontnFrom and then June in MonthTo the table is filtered to show rows in which both conditions are met (which is never, so that is why you get blanks. You have a couple of alternatives:
1) Use the month number as the slicer:
2) Add two new unrealted tables for the MonthFrom and MonthTo (you only need the months and month numbers in these new tables. The model looks like this:
Then create the follwoing measures to use as filter for the corresponding visuals in the Filter Pane:
1) Add this measure to the table visual's filter pane and set the resulting value to 1
Filter Result Table =
COUNTROWS (
FILTER (
'Date Table',
'Date Table'[MonthNum] >= SELECTEDVALUE ( 'From Date'[MonthNum] )
&& 'Date Table'[MonthNum] <= SELECTEDVALUE ( 'To Date'[MonthNum] )
)
)
2) Add this measure to the MonthFrom Slicer's filter pane and set the value to 1
Filter From =
VAR SelValue = SELECTEDVALUE('To Date'[MonthNum])
RETURN
COUNTROWS(FILTER('From Date', 'From Date'[MonthNum] < SelValue))
3) Add this measure to the MonthTo Slicer's filter pane and set the value to 1
Filter To =
VAR SelValue = SELECTEDVALUE('From Date'[MonthNum])
RETURN
COUNTROWS(FILTER('To Date', 'To Date'[MonthNum] > SelValue))
And this is what you get:
I've attached the sample PBIX file
Proud to be a Super User!
Paul on Linkedin.
It's normal since you are comparing two string columns I suppose, so the result remains the same.
You are comparing for example "January" to "January" the two strings are equal so you won't have the error message.
Try the following :
FromToMeasure = IF(SELECTEDVALUE('Sorted Calendar'[MonthNum]) > SELECTEDVALUE('Sorted Calendar'[MonthNum]), "Sélection invalide" , "")
OMG didn't pay attention to that ! you saved my life thanks
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
125 | |
84 | |
67 | |
54 | |
43 |
User | Count |
---|---|
203 | |
106 | |
98 | |
65 | |
56 |