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
hidzirf
Helper I
Helper I

How to show default month in card

Hello Experts,

 

Giving an example as below:

 

Number

Question

Result

Date

123

Q1

5

30/12/2021

456

Q1

2

1/1/2022

789

Q1

2

15/1/2022

123

Q2

3

30/12/2021

123

Q3

2

30/12/2021

456

Q2

4

1/1/2022

147

Q1

3

15/8/2022

Table1

 

Date

MonthYear

30/12/2021

Dec-2021

1/1/2022

Jan-2022

15/1/2022

Jan-2022

30/12/2021

Dec-2021

30/12/2021

Dec-2021

1/1/2022

Jan-2022

15/8/2022

Feb-2022

Table2 (Mark as Date Table)

 

I already have a measure to show a graph for all the rows in the table1.
Measure = DISTINCTCOUNT(Table1[Number])

Now I would like to create another measure because I want to show the default value in a card only for MonthYear Feb-2022 which should show as 1. The value will change accordingly using the slicer.

Appreciate it if anyone can assist.

1 ACCEPTED SOLUTION

Hi @tamerj1 ,

 

I was finally able to get a solution using ISFILTERED. Thank you for your time and effort in solving my query. Really appreciate it.

View solution in original post

11 REPLIES 11
priyansh081
New Member

hey can you please share the code, i am facing the same issue

tamerj1
Super User
Super User

Hi @hidzirf 

you can try

IF (

ISBLANK ( ALLSELECTED ( 'Date'[MonthYear] ) ),

CALCULATE ( DISTINCTCOUNT(Table1[Number]), 'Date'[MonthYear] = "Feb-2022" ),

DISTINCTCOUNT(Table1[Number])
)

Hi @tamerj1 ,

 

Thank you for your reply. I have tried this measure before but it gave me the error "A table of multiple values was supplied where a single value was expected"

 

I created a new measure like this but it gave me Blank instead. What could be wrong?

IF(
ISFILTERED(Date[MonthYear]),
CALCULATE([Measure]),
CALCULATE([Measure], 'Date'[MonthYear] = "Feb-2022")
)
 
Thank you.
 
 

@hidzirf 
Ok I think I missed a small bu important detail in my first measure.

Measure1 =
IF (
    ISBLANK ( COUNTROWS ( ALLSELECTED ( 'Date'[MonthYear] ) ) ),
    CALCULATE ( [Measure], 'Date'[MonthYear] = "Feb-2022" ),
    [Measure]
)

hI @tamerj1 

 

This measure returns the value for the distinct count in table 1.

Ok. And what do want to return?

@tamerj1 ,

 

I'm sorry...the measure returns the value that counts all the rows in table1 while it should only return for only Feb-2022

Can you please share a screenshot of your visual. Please hide any sensitive data

Hi @tamerj1 ,

 

I was finally able to get a solution using ISFILTERED. Thank you for your time and effort in solving my query. Really appreciate it.

@hidzirf 
I'm not sure what your desired result is. I thought you want to display the result on a card visual. My undestanding that you want to display the defualt measure value that is on Feb. 22 if there is no selection on the slicer. And to display the original measure value in case a selection has been made on the slicer. Right? 

Hi @tamerj1 ,

 

Yes, your understanding is correct. Should I not use IsFiltered? What I understand IsFiltered can return a True value if the column does not have a filter. I appreciate your knowledge and help.

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.